Created
January 5, 2024 01:21
-
-
Save mmouih/6b16ee9ef73b50b20159c6e99413d840 to your computer and use it in GitHub Desktop.
User Payload implements an payload interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Payload; | |
use Symfony\Component\Validator\Constraints as Assert; | |
use Symfony\Component\Validator\Constraints\Length; | |
use Symfony\Component\Validator\Constraints\Type; | |
readonly class User implements PayloadInterface | |
{ | |
public function __construct( | |
#[Length(min: 3)] | |
#[Type(type: 'alpha')] | |
public string $name, | |
#[Assert\Valid] | |
public ?Address $address = null, | |
) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment