|
4 | 4 |
|
5 | 5 | namespace RZ\Roadiz\Core\AbstractEntities; |
6 | 6 |
|
| 7 | +use ApiPlatform\Doctrine\Orm\Filter\OrderFilter; |
| 8 | +use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
| 9 | +use ApiPlatform\Metadata\ApiFilter; |
7 | 10 | use Doctrine\ORM\Mapping as ORM; |
8 | | -use JMS\Serializer\Annotation as Serializer; |
9 | | -use Symfony\Component\Serializer\Annotation as SymfonySerializer; |
| 11 | +use Symfony\Component\Serializer\Attribute as Serializer; |
10 | 12 | use Symfony\Component\Validator\Constraints as Assert; |
11 | 13 |
|
12 | 14 | /** |
|
17 | 19 | #[ORM\MappedSuperclass, |
18 | 20 | ORM\Table, |
19 | 21 | ORM\HasLifecycleCallbacks] |
20 | | -abstract class AbstractHuman extends AbstractDateTimed |
| 22 | +abstract class AbstractHuman implements DateTimedInterface, PersistableInterface |
21 | 23 | { |
22 | | - #[ORM\Column(type: 'string', length: 200, unique: true), |
23 | | - Serializer\Groups(['user_personal', 'human']), |
24 | | - SymfonySerializer\Groups(['user_personal', 'human']), |
25 | | - Assert\NotNull(), |
26 | | - Assert\NotBlank(), |
27 | | - Assert\Length(max: 200), |
28 | | - Assert\Email()] |
| 24 | + use SequentialIdTrait; |
| 25 | + use DateTimedTrait; |
| 26 | + |
| 27 | + #[ORM\Column(type: 'string', length: 200, unique: true, nullable: false)] |
| 28 | + #[Serializer\Groups(['user_personal', 'human'])] |
| 29 | + #[Assert\NotNull] |
| 30 | + #[Assert\NotBlank] |
| 31 | + #[Assert\Length(max: 200)] |
| 32 | + #[Assert\Email] |
| 33 | + #[ApiFilter(OrderFilter::class)] |
| 34 | + #[ApiFilter(SearchFilter::class)] |
| 35 | + // @phpstan-ignore-next-line |
29 | 36 | protected ?string $email = null; |
30 | 37 |
|
31 | 38 | /** |
32 | 39 | * Public name (pseudonyme) that can be displayed to a public audience. |
33 | 40 | */ |
34 | 41 | #[ORM\Column(name: 'publicName', type: 'string', length: 250, nullable: true), |
35 | 42 | Serializer\Groups(['user_public', 'human']), |
36 | | - SymfonySerializer\Groups(['user_public', 'human']), |
37 | 43 | Assert\Length(max: 250)] |
38 | 44 | protected ?string $publicName = null; |
39 | 45 |
|
40 | 46 | #[ORM\Column(name: 'firstName', type: 'string', length: 250, nullable: true), |
41 | 47 | Serializer\Groups(['user_personal', 'human']), |
42 | | - SymfonySerializer\Groups(['user_personal', 'human']), |
43 | 48 | Assert\Length(max: 250)] |
44 | 49 | protected ?string $firstName = null; |
45 | 50 |
|
46 | 51 | #[ORM\Column(name: 'lastName', type: 'string', length: 250, nullable: true), |
47 | 52 | Serializer\Groups(['user_personal', 'human']), |
48 | | - SymfonySerializer\Groups(['user_personal', 'human']), |
49 | 53 | Assert\Length(max: 250)] |
50 | 54 | protected ?string $lastName = null; |
51 | 55 |
|
52 | 56 | #[ORM\Column(type: 'string', length: 250, nullable: true), |
53 | 57 | Serializer\Groups(['user_personal', 'human']), |
54 | | - SymfonySerializer\Groups(['user_personal', 'human']), |
55 | 58 | Assert\Length(max: 250)] |
56 | 59 | protected ?string $company = null; |
57 | 60 |
|
|
0 commit comments