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.     #[Groups(['preview', 'listing'])]
  50.     protected ?int $appearance;
  51.     #[ORM\Column(name: 'has_tattoo', type: 'boolean', nullable: true)]
  52.     #[Groups(['preview', 'listing'])]
  53.     protected ?bool $hasTattoo;
  54.     #[ORM\Column(name: 'has_piercing', type: 'boolean', nullable: true)]
  55.     #[Groups(['preview', 'listing'])]
  56.     protected ?bool $hasPiercing;
  57.     public function __construct(
  58.         ?int $gender,
  59.         ?int $age,
  60.         ?int $height,
  61.         ?int $weight,
  62.         ?int $breastSize,
  63.         ?int $breastType,
  64.         ?int $clothSize,
  65.         ?int $shoesSize,
  66.         ?int $bodyType,
  67.         ?int $hairColor,
  68.         ?int $privateHaircut,
  69.         ?int $nationality,
  70.         ?int $appearance,
  71.         ?bool $hasTattoo,
  72.         ?bool $hasPiercing
  73.     ) {
  74.         $this->gender = $gender ?? Genders::FEMALE;
  75.         $this->age = $age;
  76.         $this->height = $height;
  77.         $this->weight = $weight;
  78.         $this->breastSize = $breastSize;
  79.         $this->breastType = $breastType;
  80.         $this->clothSize = $clothSize;
  81.         $this->shoesSize = $shoesSize;
  82.         $this->bodyType = $bodyType;
  83.         $this->hairColor = $hairColor;
  84.         $this->privateHaircut = $privateHaircut;
  85.         $this->nationality = $nationality;
  86.         $this->appearance = $appearance;
  87.         $this->hasTattoo = $hasTattoo;
  88.         $this->hasPiercing = $hasPiercing;
  89.         if (null == $gender)
  90.             $gender = Genders::FEMALE;
  91.         if (false === array_search($gender, [Genders::FEMALE, Genders::MALE, Genders::TRANS]))
  92.             throw new \LogicException('Invalid gender type');
  93.         $this->gender = $gender;
  94.     }
  95.     public function getGender(): int
  96.     {
  97.         return $this->gender;
  98.     }
  99.     public function setGender(int $gender): void
  100.     {
  101.         $this->gender = $gender;
  102.     }
  103.     public function getAge(): ?int
  104.     {
  105.         return $this->age;
  106.     }
  107.     public function getHeight(): ?int
  108.     {
  109.         return $this->height;
  110.     }
  111.     public function getWeight(): ?int
  112.     {
  113.         return $this->weight;
  114.     }
  115.     public function getBreastSize(): ?int
  116.     {
  117.         return $this->breastSize;
  118.     }
  119.     public function getBreastType(): ?int
  120.     {
  121.         return $this->breastType;
  122.     }
  123.     public function getClothSize(): ?int
  124.     {
  125.         return $this->clothSize;
  126.     }
  127.     public function getShoesSize(): ?int
  128.     {
  129.         return $this->shoesSize;
  130.     }
  131.     public function getBodyType(): ?int
  132.     {
  133.         return $this->bodyType;
  134.     }
  135.     public function getHairColor(): ?int
  136.     {
  137.         return $this->hairColor;
  138.     }
  139.     public function getPrivateHaircut(): ?int
  140.     {
  141.         return $this->privateHaircut;
  142.     }
  143.     public function getNationality(): ?int
  144.     {
  145.         return $this->nationality;
  146.     }
  147.     public function getAppearance(): ?int
  148.     {
  149.         return $this->appearance;
  150.     }
  151.     public function hasTattoo(): ?bool
  152.     {
  153.         return $this->hasTattoo;
  154.     }
  155.     public function hasPiercing(): ?bool
  156.     {
  157.         return $this->hasPiercing;
  158.     }
  159. }