Php Api平台对itemOperations上的非规范化上下文组执行PUT操作无效

Php Api平台对itemOperations上的非规范化上下文组执行PUT操作无效,php,symfony,api-platform.com,Php,Symfony,Api Platform.com,我有两个实体: 我只想为项目操作检索单词,而不是为收集操作检索单词,因此我添加了一个组GET“item\u words.read”和PUT反规范化上下文 对于GET操作来说,它非常有效,因为某些原因,PUT操作没有给我“words”子资源 获取: 付诸表决: 这是我的密码: 项目 挖掘一段时间后,要使其工作,操作中必须存在“方法” 他是工人 /** * @ApiResource( * normalizationContext={"groups"={"

我有两个实体:

我只想为
项目操作
检索单词,而不是为
收集操作
检索单词,因此我添加了一个组GET
“item\u words.read”
和PUT
反规范化上下文

对于GET操作来说,它非常有效,因为某些原因,PUT操作没有给我“words”子资源

获取:

付诸表决:

这是我的密码:

项目


挖掘一段时间后,要使其工作,操作中必须存在
“方法”

他是工人

/**
 * @ApiResource(
 *     normalizationContext={"groups"={"item.read"}},
 *     denormalizationContext={"groups"={"item.write"}},
 *     collectionOperations={"get", "post"},
 *     itemOperations={
 *          "get"={
 *              "method"="GET",
 *              "normalization_context"={"groups"={"item.read","item_words.read"}},
 *          },
 *          "put"={
 *              "method"="PUT",
 *              "normalization_context"={"groups"={"item.write", "item_words.write"}},
 *          },
 *         "delete",
 *         "getItemVocabulary"={
 *                   "method"="GET",
 *                   "path"="/items/{id}/vocabulary",
 *                   "controller"=ItemVocabularyController::class,
 *                  }
 *     }
 * )
 * @ORM\Entity
 * @ORM\Table(name="`items`")
 */
<?php

namespace App\Entity;

use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\WordRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Ramsey\Uuid\Uuid;
use Symfony\Component\Serializer\Annotation\Groups;


/**
 * @ORM\Entity
 * @ApiResource(attributes={"order"={"value": "ASC"}})
 * @ORM\Table(name="`words`")
 */
class Word
{
    /**
     *
     * @ORM\Id
     * @ORM\Column(type="uuid", unique=true)
     */
    private $id;

    /**
     * @Groups({"item_words.read"}),
     * @ORM\Column(type="string", length=255)
     */
    private $value;


    /* ---------------------------------------------------------------------------------------------- */
    /* ---------------------------------------------------------------------------------------------- */
    /* ---------------------------------------------------------------------------------------------- */
    /* ----------------------------------------GETTER AND SETTER------------------------------------- */
    /* ---------------------------------------------------------------------------------------------- */
    /* ---------------------------------------------------------------------------------------------- */
    /* ---------------------------------------------------------------------------------------------- */



    public function __construct()
    {
        $this->id = Uuid::uuid4();
    }

    public function getId()
    {
        return $this->id;
    }

    public function getValue(): ?string
    {
        return $this->value;
    }

    public function setValue(string $value): self
    {
        $this->value = $value;

        return $this;
    }


}
/**
 * @ApiResource(
 *     normalizationContext={"groups"={"item.read"}},
 *     denormalizationContext={"groups"={"item.write"}},
 *     collectionOperations={"get", "post"},
 *     itemOperations={
 *          "get"={
 *              "method"="GET",
 *              "normalization_context"={"groups"={"item.read","item_words.read"}},
 *          },
 *          "put"={
 *              "method"="PUT",
 *              "normalization_context"={"groups"={"item.write", "item_words.write"}},
 *          },
 *         "delete",
 *         "getItemVocabulary"={
 *                   "method"="GET",
 *                   "path"="/items/{id}/vocabulary",
 *                   "controller"=ItemVocabularyController::class,
 *                  }
 *     }
 * )
 * @ORM\Entity
 * @ORM\Table(name="`items`")
 */