src/Entity/Profile/PersonParameters.php line 14

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by simpson <simpsonwork@gmail.com>
  4.  * Date: 2019-03-19
  5.  * Time: 17:35
  6.  */
  7. namespace App\Entity\Profile;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. #[ORM\Embeddable]
  11. final class PersonParameters
  12. {
  13.     #[ORM\Column(name: 'gender', type: 'smallint', nullable: false, options: ['default' => 1])]
  14.     protected ?int $gender;
  15.     #[ORM\Column(name: 'age', type: 'smallint', nullable: true)]
  16.     #[Groups(['preview', 'listing'])]
  17.     protected ?int $age;
  18.     #[ORM\Column(name: 'height', type: 'smallint', nullable: true)]
  19.     #[Groups(['preview', 'listing'])]
  20.     protected ?int $height;
  21.     #[ORM\Column(name: 'weight', type: 'smallint', nullable: true)]
  22.     #[Groups(['preview', 'listing'])]
  23.     protected ?int $weight;
  24.     #[ORM\Column(name: 'breast_size', type: 'smallint', nullable: true)]
  25.     #[Groups(['preview', 'listing'])]
  26.     protected ?int $breastSize;
  27.     #[ORM\Column(name: 'breast_type', type: 'smallint', nullable: true)]
  28.     #[Groups(['preview', 'listing'])]
  29.     protected ?int $breastType;
  30.     #[ORM\Column(name: 'cloth_size', type: 'smallint', nullable: true)]
  31.     #[Groups(['preview', 'listing'])]
  32.     protected ?int $clothSize;
  33.     #[ORM\Column(name: 'shoes_size', type: 'smallint', nullable: true)]
  34.     #[Groups(['preview', 'listing'])]
  35.     protected ?int $shoesSize;
  36.     #[ORM\Column(name: 'body_type', type: 'smallint', nullable: true)]
  37.     #[Groups(['preview', 'listing'])]
  38.     protected ?int $bodyType;
  39.     #[ORM\Column(name: 'hair_color', type: 'smallint', nullable: true)]
  40.     #[Groups(['preview', 'listing'])]
  41.     protected ?int $hairColor;
  42.     #[ORM\Column(name: 'private_haircut', type: 'smallint', nullable: true)]
  43.     #[Groups(['preview', 'listing'])]
  44.     protected ?int $privateHaircut;
  45.     #[ORM\Column(name: 'nationality', type: 'smallint', nullable: true)]
  46.     #[Groups(['preview', 'listing'])]
  47.     protected ?int $nationality;
  48.     #[ORM\Column(name: 'appearance', type: 'smallint', nullable: true)]
  49.     protected ?int $appearance;
  50.     #[ORM\Column(name: 'has_tattoo', type: 'boolean', nullable: true)]
  51.     #[Groups(['preview', 'listing'])]
  52.     protected ?bool $hasTattoo;
  53.     #[ORM\Column(name: 'has_piercing', type: 'boolean', nullable: true)]
  54.     #[Groups(['preview', 'listing'])]
  55.     protected ?bool $hasPiercing;
  56.     public function __construct(
  57.         ?int $gender,
  58.         ?int $age,
  59.         ?int $height,
  60.         ?int $weight,
  61.         ?int $breastSize,
  62.         ?int $breastType,
  63.         ?int $clothSize,
  64.         ?int $shoesSize,
  65.         ?int $bodyType,
  66.         ?int $hairColor,
  67.         ?int $privateHaircut,
  68.         ?int $nationality,
  69.         ?int $appearance,
  70.         ?bool $hasTattoo,
  71.         ?bool $hasPiercing
  72.     ) {
  73.         $this->gender = $gender ?? Genders::FEMALE;
  74.         $this->age = $age;
  75.         $this->height = $height;
  76.         $this->weight = $weight;
  77.         $this->breastSize = $breastSize;
  78.         $this->breastType = $breastType;
  79.         $this->clothSize = $clothSize;
  80.         $this->shoesSize = $shoesSize;
  81.         $this->bodyType = $bodyType;
  82.         $this->hairColor = $hairColor;
  83.         $this->privateHaircut = $privateHaircut;
  84.         $this->nationality = $nationality;
  85.         $this->appearance = $appearance;
  86.         $this->hasTattoo = $hasTattoo;
  87.         $this->hasPiercing = $hasPiercing;
  88.         if (null == $gender)
  89.             $gender = Genders::FEMALE;
  90.         if (false === array_search($gender, [Genders::FEMALE, Genders::MALE, Genders::TRANS]))
  91.             throw new \LogicException('Invalid gender type');
  92.         $this->gender = $gender;
  93.     }
  94.     public function getGender(): int
  95.     {
  96.         return $this->gender;
  97.     }
  98.     public function setGender(int $gender): void
  99.     {
  100.         $this->gender = $gender;
  101.     }
  102.     public function getAge(): ?int
  103.     {
  104.         return $this->age;
  105.     }
  106.     public function getHeight(): ?int
  107.     {
  108.         return $this->height;
  109.     }
  110.     public function getWeight(): ?int
  111.     {
  112.         return $this->weight;
  113.     }
  114.     public function getBreastSize(): ?int
  115.     {
  116.         return $this->breastSize;
  117.     }
  118.     public function getBreastType(): ?int
  119.     {
  120.         return $this->breastType;
  121.     }
  122.     public function getClothSize(): ?int
  123.     {
  124.         return $this->clothSize;
  125.     }
  126.     public function getShoesSize(): ?int
  127.     {
  128.         return $this->shoesSize;
  129.     }
  130.     public function getBodyType(): ?int
  131.     {
  132.         return $this->bodyType;
  133.     }
  134.     public function getHairColor(): ?int
  135.     {
  136.         return $this->hairColor;
  137.     }
  138.     public function getPrivateHaircut(): ?int
  139.     {
  140.         return $this->privateHaircut;
  141.     }
  142.     public function getNationality(): ?int
  143.     {
  144.         return $this->nationality;
  145.     }
  146.     public function getAppearance(): ?int
  147.     {
  148.         return $this->appearance;
  149.     }
  150.     public function hasTattoo(): ?bool
  151.     {
  152.         return $this->hasTattoo;
  153.     }
  154.     public function hasPiercing(): ?bool
  155.     {
  156.         return $this->hasPiercing;
  157.     }
  158. }