2025-04-23 18:55:51 +02:00

81 lines
1.6 KiB
PHP

<?php
namespace App\Domain\Model;
use App\Infrastructure\Repository\UserRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\Table(name: 'app_user')]
class User
{
#[ORM\Id]
#[ORM\Column(type: 'string')]
private string $id;
#[ORM\Column(type: 'string', length: 255, unique: true)]
#[Assert\NotBlank]
#[Assert\Email]
private string $email;
#[ORM\Column(type: 'string', length: 255)]
#[Assert\NotBlank]
private string $firstName;
#[ORM\Column(type: 'string', length: 255)]
#[Assert\NotBlank]
private string $lastName;
public function __construct()
{
$this->id = Uuid::v4()->toRfc4122();
}
public function getId(): string
{
return $this->id;
}
public function getEmail(): string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getFirstName(): string
{
return $this->firstName;
}
public function setFirstName(string $firstName): self
{
$this->firstName = $firstName;
return $this;
}
public function getLastName(): string
{
return $this->lastName;
}
public function setLastName(string $lastName): self
{
$this->lastName = $lastName;
return $this;
}
public function getFullName(): string
{
return "$this->firstName $this->lastName";
}
}