Create genderEnum, add genderTranslation property to Gender entity and new gender property to Person entity

Also migrations were created to handle the changes in the database.
This commit is contained in:
2024-09-26 12:20:36 +02:00
parent f428afc7ca
commit b78f0980f5
5 changed files with 135 additions and 18 deletions

View File

@@ -25,9 +25,9 @@ class Gender
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $active = true;
#[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $isGrammatical = true;
#[Assert\NotNull(message: 'You must choose a gender translation')]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, enumType: GenderEnum::class)]
private GenderEnum $genderTranslation;
#[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
@@ -61,14 +61,14 @@ class Gender
$this->active = $active;
}
public function isGrammatical(): bool
public function getGenderTranslation(): GenderEnum
{
return $this->isGrammatical;
return $this->genderTranslation;
}
public function setIsGrammatical(bool $isGrammatical): void
public function setGenderTranslation(GenderEnum $genderTranslation): void
{
$this->isGrammatical = $isGrammatical;
$this->$genderTranslation = $genderTranslation;
}
public function getIcon(): string

View File

@@ -0,0 +1,11 @@
<?php
namespace Chill\MainBundle\Entity;
enum GenderEnum : string
{
case MALE = 'man';
case FEMALE = 'woman';
case NEUTRAL = 'neutral';
case UNKNOWN = 'unknown';
}