Symfony 给定的整数属性应为IRI或嵌套文档
您好,我有一个问题,如果有人可以帮助我,请! 我有一个投递路线来投递候选人。 问题是当用户想要提交候选资格时,他必须选择一个挑战id! 因此,当我尝试在Postman上手动提交候选资格时,我输入了质询ID,但出现以下错误:Symfony 给定的整数属性应为IRI或嵌套文档,symfony,api-platform.com,Symfony,Api Platform.com,您好,我有一个问题,如果有人可以帮助我,请! 我有一个投递路线来投递候选人。 问题是当用户想要提交候选资格时,他必须选择一个挑战id! 因此,当我尝试在Postman上手动提交候选资格时,我输入了质询ID,但出现以下错误: 给定属性“challenge\”和“integer\”时需要IRI或嵌套文档。 但是,当我尝试使用IRI时,比如:/api/challenges/2,它工作得非常好 所以我想知道是否有人有这个问题,或者如果你知道一个解决方案,请,这一天我一直在寻找这个^^ 候选实体 /**
给定属性“challenge\”和“integer\”时需要IRI或嵌套文档。
但是,当我尝试使用IRI时,比如:/api/challenges/2
,它工作得非常好
所以我想知道是否有人有这个问题,或者如果你知道一个解决方案,请,这一天我一直在寻找这个^^
候选实体
/**
* @ORM\Entity(repositoryClass=CandidatureRepository::class)
* @ApiResource(
* denormalizationContext={"group"={"write:candidature"}},
* normalizationContext={"groups"={"read:candidature"}}
* )
*/
class Candidature
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({"read:candidature", "user:read"})
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Groups({"read:candidature", "user:read"})
*/
private $statut = 'Candidacy sent';
/**
* @ORM\Column(type="date", nullable=true)
* @Groups({"read:candidature", "user:read"})
*/
private $date;
/**
* @ORM\Column(type="date", nullable=true)
* @Groups({"read:candidature", "user:read"})
*/
private $dateReponse;
/**
* @ORM\ManyToOne(targetEntity=Challenge::class, inversedBy="candidatures")
* @Groups({"read:candidature", "user:read"})
*/
private $challenge;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="candidature")
*/
private $user;
挑战实体
class Challenge
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({"read:candidature"})
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Groups({"read:candidature"})
*/
private $titre;
/**
* @ORM\Column(type="string", length=255)
*/
private $slug;
/**
* @ORM\Column(type="string", length=255)
*/
private $resume;
/**
* @ORM\Column(type="text")
*/
private $description;
/**
* @ORM\OneToMany(targetEntity=Candidature::class, mappedBy="challenge")
*/
private $candidatures;
你有什么问题?你想用身份证而不是IRI?是的!你知道吗?