Ecodev /
felix
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace EcodevTests\Felix\Blog\Model; |
||
| 6 | |||
| 7 | use Doctrine\Common\Collections\Collection; |
||
| 8 | use Doctrine\ORM\Mapping as ORM; |
||
| 9 | use Ecodev\Felix\Acl\MultipleRoles; |
||
| 10 | use GraphQL\Doctrine\Attribute as API; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * A blog author. |
||
| 14 | */ |
||
| 15 | #[ORM\Entity] |
||
| 16 | final class User extends AbstractModel implements \Ecodev\Felix\Model\User |
||
| 17 | { |
||
| 18 | #[ORM\Column(name: 'custom_column_name', type: 'string', length: 50, options: ['default' => ''])] |
||
| 19 | private string $name = ''; |
||
| 20 | |||
| 21 | #[ORM\Column(type: 'string', length: 50, nullable: true)] |
||
| 22 | private ?string $email = null; |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 23 | |||
| 24 | #[ORM\Column(name: 'password', type: 'string', length: 255)] |
||
| 25 | #[API\Exclude] |
||
| 26 | private string $password; |
||
|
0 ignored issues
–
show
|
|||
| 27 | |||
| 28 | #[ORM\OneToMany(targetEntity: 'EcodevTests\Felix\Blog\Model\Post', mappedBy: 'user')] |
||
| 29 | private Collection $posts; |
||
|
0 ignored issues
–
show
|
|||
| 30 | |||
| 31 | public function __construct( |
||
| 32 | private MultipleRoles|string $role = 'member', |
||
| 33 | ) {} |
||
| 34 | |||
| 35 | public function getName(): string |
||
| 36 | { |
||
| 37 | return $this->name; |
||
| 38 | } |
||
| 39 | |||
| 40 | public function setName(string $name): void |
||
| 41 | { |
||
| 42 | $this->name = $name; |
||
| 43 | } |
||
| 44 | |||
| 45 | public function getRole(): string|MultipleRoles |
||
| 46 | { |
||
| 47 | return $this->role; |
||
| 48 | } |
||
| 49 | |||
| 50 | public function getLogin(): ?string |
||
| 51 | { |
||
| 52 | return $this->name; |
||
| 53 | } |
||
| 54 | } |
||
| 55 |