25 lines
537 B
PHP
25 lines
537 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace App\Dto;
|
||
|
|
|
||
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Validated payload for PATCH /api/todos/{id}.
|
||
|
|
*
|
||
|
|
* All fields are nullable so PATCH callers can send only the fields
|
||
|
|
* they want to change. The controller checks each for null and
|
||
|
|
* skips the corresponding entity setter.
|
||
|
|
*/
|
||
|
|
final readonly class UpdateTodoDto
|
||
|
|
{
|
||
|
|
public function __construct(
|
||
|
|
#[Assert\Length(max: 255)]
|
||
|
|
public ?string $title = null,
|
||
|
|
public ?bool $done = null,
|
||
|
|
) {
|
||
|
|
}
|
||
|
|
}
|