【发布时间】:2020-07-23 22:58:41
【问题描述】:
我遇到了 Api 平台的问题,我开始工作时已经存在的一些代码让我很生气。 这里是:
/**
* Class PhysicalProfile.
*
* @ORM\Table(name="front_user_physical_profile")
* @ORM\Entity(repositoryClass="App\Repository\PhysicalProfileRepository")
* @ApiResource(
* denormalizationContext={"groups"={"update"}},
* collectionOperations={"create"={
* "method"="POST",
* "path"="/physical-profile",
* "access_control"="is_granted('ROLE_USER')"
* }, "whoami"={"route_name"="api_security_physicalprofile_whoami"}
* },
* itemOperations={
* "get"={"access_control"="is_granted('ROLE_USER')", "normalizationContext"={"groups"={"null"}}},
* }
* )
* @ORM\HasLifecycleCallbacks()
*/
我想做的就是像这样在查询中传递一个元素:
/physical-profile/{store}
然后在我的代码中使用它。
除了我在 Api-platform 的文档中找不到任何帮助,这让我想知道我想要的是否可能。 这就是我来这里的原因,想弄清楚是否有人知道这是否可能,以及如何去做。 谢谢!
编辑:store 不是一个 id 而是一个字符串
【问题讨论】:
标签: php api symfony api-platform.com