feat: category and phone number for contacts
This commit is contained in:
@@ -9,6 +9,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||
#[ORM\Entity(repositoryClass: ContactRepository::class)]
|
||||
class Contact
|
||||
{
|
||||
public const CATEGORY_MANAGEMENT = 'management';
|
||||
public const CATEGORY_HOUSE_MANAGEMENT = 'house_management';
|
||||
public const CATEGORY_HR = 'hr';
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
@@ -23,6 +27,10 @@ class Contact
|
||||
#[Assert\Email(message: 'Bitte gib eine gültige E-Mail-Adresse an', mode: 'strict')]
|
||||
private ?string $email = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
#[Assert\NotBlank(message: 'Bitte gib die Telefonnummer an')]
|
||||
private ?string $phone = null;
|
||||
|
||||
#[ORM\OneToOne(cascade: ['persist', 'remove'], fetch: 'EAGER')]
|
||||
#[Assert\NotNull(message: 'Bitte lade ein Foto hoch')]
|
||||
private ?Upload $photo = null;
|
||||
@@ -30,6 +38,11 @@ class Contact
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $destination = null;
|
||||
|
||||
#[ORM\Column(length: 64)]
|
||||
#[Assert\NotBlank(message: 'Bitte wähle die Kategorie')]
|
||||
#[Assert\Choice(choices: [self::CATEGORY_HOUSE_MANAGEMENT, self::CATEGORY_MANAGEMENT, self::CATEGORY_HR], message: 'Die Kagegorie ist ungültig')]
|
||||
private ?string $category = null;
|
||||
|
||||
#[ORM\OneToOne(mappedBy: 'contact', cascade: ['persist', 'remove'], fetch: 'EXTRA_LAZY')]
|
||||
private ?User $user = null;
|
||||
|
||||
@@ -67,6 +80,18 @@ class Contact
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPhone(): ?string
|
||||
{
|
||||
return $this->phone;
|
||||
}
|
||||
|
||||
public function setPhone(?string $phone): static
|
||||
{
|
||||
$this->phone = $phone;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPhoto(): ?Upload
|
||||
{
|
||||
return $this->photo;
|
||||
@@ -91,6 +116,18 @@ class Contact
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCategory(): ?string
|
||||
{
|
||||
return $this->category;
|
||||
}
|
||||
|
||||
public function setCategory(?string $category): static
|
||||
{
|
||||
$this->category = $category;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUser(): ?User
|
||||
{
|
||||
return $this->user;
|
||||
|
||||
Reference in New Issue
Block a user