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'nullablefalseoptions: ['default' => 1])]
  14.     protected ?int $gender;
  15.     #[ORM\Column(name'age'type'smallint'nullabletrue)]
  16.     #[Groups(['preview''listing'])]
  17.     protected ?int $age;
  18.     #[ORM\Column(name'height'type'smallint'nullabletrue)]
  19.     #[Groups(['preview''listing'])]
  20.     protected ?int $height;
  21.     #[ORM\Column(name'weight'type'smallint'nullabletrue)]
  22.     #[Groups(['preview''listing'])]
  23.     protected ?int $weight;
  24.     #[ORM\Column(name'breast_size'type'smallint'nullabletrue)]
  25.     #[Groups(['preview''listing'])]
  26.     protected ?int $breastSize;
  27.     #[ORM\Column(name'breast_type'type'smallint'nullabletrue)]
  28.     #[Groups(['preview''listing'])]
  29.     protected ?int $breastType;
  30.     #[ORM\Column(name'cloth_size'type'smallint'nullabletrue)]
  31.     #[Groups(['preview''listing'])]
  32.     protected ?int $clothSize;
  33.     #[ORM\Column(name'shoes_size'type'smallint'nullabletrue)]
  34.     #[Groups(['preview''listing'])]
  35.     protected ?int $shoesSize;
  36.     #[ORM\Column(name'body_type'type'smallint'nullabletrue)]
  37.     #[Groups(['preview''listing'])]
  38.     protected ?int $bodyType;
  39.     #[ORM\Column(name'hair_color'type'smallint'nullabletrue)]
  40.     #[Groups(['preview''listing'])]
  41.     protected ?int $hairColor;
  42.     #[ORM\Column(name'private_haircut'type'smallint'nullabletrue)]
  43.     #[Groups(['preview''listing'])]
  44.     protected ?int $privateHaircut;
  45.     #[ORM\Column(name'nationality'type'smallint'nullabletrue)]
  46.     #[Groups(['preview''listing'])]
  47.     protected ?int $nationality;
  48.     #[ORM\Column(name'has_tattoo'type'boolean'nullabletrue)]
  49.     #[Groups(['preview''listing'])]
  50.     protected ?bool $hasTattoo;
  51.     #[ORM\Column(name'has_piercing'type'boolean'nullabletrue)]
  52.     #[Groups(['preview''listing'])]
  53.     protected ?bool $hasPiercing;
  54.     public function __construct(
  55.         ?int $gender,
  56.         ?int $age,
  57.         ?int $height,
  58.         ?int $weight,
  59.         ?int $breastSize,
  60.         ?int $breastType,
  61.         ?int $clothSize,
  62.         ?int $shoesSize,
  63.         ?int $bodyType,
  64.         ?int $hairColor,
  65.         ?int $privateHaircut,
  66.         ?int $nationality,
  67.         ?bool $hasTattoo,
  68.         ?bool $hasPiercing
  69.     ) {
  70.         $this->gender $gender ?? Genders::FEMALE;
  71.         $this->age $age;
  72.         $this->height $height;
  73.         $this->weight $weight;
  74.         $this->breastSize $breastSize;
  75.         $this->breastType $breastType;
  76.         $this->clothSize $clothSize;
  77.         $this->shoesSize $shoesSize;
  78.         $this->bodyType $bodyType;
  79.         $this->hairColor $hairColor;
  80.         $this->privateHaircut $privateHaircut;
  81.         $this->nationality $nationality;
  82.         $this->hasTattoo $hasTattoo;
  83.         $this->hasPiercing $hasPiercing;
  84.         if (null == $gender)
  85.             $gender Genders::FEMALE;
  86.         if (false === array_search($gender, [Genders::FEMALEGenders::MALEGenders::TRANS]))
  87.             throw new \LogicException('Invalid gender type');
  88.         $this->gender $gender;
  89.     }
  90.     public function getGender(): int
  91.     {
  92.         return $this->gender;
  93.     }
  94.     public function setGender(int $gender): void
  95.     {
  96.         $this->gender $gender;
  97.     }
  98.     public function getAge(): ?int
  99.     {
  100.         return $this->age;
  101.     }
  102.     public function getHeight(): ?int
  103.     {
  104.         return $this->height;
  105.     }
  106.     public function getWeight(): ?int
  107.     {
  108.         return $this->weight;
  109.     }
  110.     public function getBreastSize(): ?int
  111.     {
  112.         return $this->breastSize;
  113.     }
  114.     public function getBreastType(): ?int
  115.     {
  116.         return $this->breastType;
  117.     }
  118.     public function getClothSize(): ?int
  119.     {
  120.         return $this->clothSize;
  121.     }
  122.     public function getShoesSize(): ?int
  123.     {
  124.         return $this->shoesSize;
  125.     }
  126.     public function getBodyType(): ?int
  127.     {
  128.         return $this->bodyType;
  129.     }
  130.     public function getHairColor(): ?int
  131.     {
  132.         return $this->hairColor;
  133.     }
  134.     public function getPrivateHaircut(): ?int
  135.     {
  136.         return $this->privateHaircut;
  137.     }
  138.     public function getNationality(): ?int
  139.     {
  140.         return $this->nationality;
  141.     }
  142.     public function hasTattoo(): ?bool
  143.     {
  144.         return $this->hasTattoo;
  145.     }
  146.     public function hasPiercing(): ?bool
  147.     {
  148.         return $this->hasPiercing;
  149.     }
  150. }