我遇到了一个Api-platform的问题,当我开始我的工作时,一些代码已经在那里了,这让我很生气。这就是它:
/**
* 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而是一个字符串
发布于 2020-07-23 14:54:07
API平台期望在像/physical-profile/{store}
这样的补丁中,最后一部分是实体ID。
如果您需要查询某些项,请使用filters。
https://stackoverflow.com/questions/63056479
复制相似问题