小编Nol*_*fer的帖子

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

我有这样的事情:

/**
 * @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)

php symfony api-platform.com

5
推荐指数
0
解决办法
265
查看次数

标签 统计

api-platform.com ×1

php ×1

symfony ×1