-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Currently, the only way code could capture invalid Uuid is by placing attributes on the field, and running the validator:
#[Assert\NotBlank]
#[Assert\Uuid]
public string $id;$command = new RegisterUserCommand($id, $login, $password);
$validator->validate($command);If the project doesn't want to use validator directly on the commands,
it would make sense to use #[Capture attribute on $id field:
use Symfony\Component\Uid\Exception\InvalidArgumentException as InvalidUidException;
#[ExceptionalValidation]
class Item
{
#[Capture(InvalidUidException::class)]
public string $id;
}In current situation, the only way to know whether the exception actually belongs to the uuid is by parsing the message from InvalidUidException.
Metadata
Metadata
Assignees
Labels
No labels