如何在 Api 平台上使用带有 Messenger 输入的路径中的 {id}?

Nol*_*fer 5 php symfony api-platform.com

我有这样的事情:

/**
 * @ORM/Entity
 * @ApiResource(
 *     itemOperations={
 *         "put_cancel": {
 *             "method": "PUT",
 *             "path": "/task/{id}/cancel",
 *             "messenger": "input",
 *             "input": CancelTaskCommand::class,
 *             "output": false
 *         },
 *     }
 * )
 */
class Foo {}
Run Code Online (Sandbox Code Playgroud)

取消FooCommand.php

final class CancelFooCommand
{
    /**
     * @var string
     * @ApiProperty(
     *     identifier=true,
     * )
     */
    public string $id = '';

    /**
     * @var string
     * @ApiProperty(
     *     attributes={
     *         "openapi_context"={
     *           "type": "string"
     *         }
     *     }
     * )
     */
    public string $note = '';
}

Run Code Online (Sandbox Code Playgroud)

所以我必须在有效负载和路径中输入两次 ID。是否可以跳过添加id到有效负载并从路径获取它?