src/Entity/Olympiad/Online/Attendant/Attendant.php line 21

  1. <?php
  2. namespace App\Entity\Olympiad\Online\Attendant;
  3. use App\Entity\Common\Country;
  4. use App\Entity\Common\Passport;
  5. use App\Entity\Geo\Region;
  6. use App\Entity\Olympiad\Online\Event;
  7. use App\Entity\Traits\CreatedTrait;
  8. use App\Entity\Traits\UpdatedTrait;
  9. use App\Entity\User\User;
  10. use App\Model\Olympiad\Online\AppliableInterface;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\ORM\Mapping as ORM;
  14. use Symfony\Component\Validator\Constraints as Assert;
  15. #[ORM\Table(name'olymp_online_attendant')]
  16. #[ORM\Entity(repositoryClass'App\Repository\Olympiad\Online\AttendantRepository')]
  17. #[ORM\HasLifecycleCallbacks]
  18. class Attendant implements AppliableInterface
  19. {
  20.     use CreatedTrait;
  21.     use UpdatedTrait;
  22.     #[ORM\ManyToOne(targetEntity'App\Entity\User\User')]
  23.     private ?User $user null;
  24.     #[ORM\Column(type'boolean'options: ['default' => false])]
  25.     private bool $canceled false;
  26.     #[ORM\Column(type'string'length36)]
  27.     private string $uuid;
  28.     #[ORM\Id]
  29.     #[ORM\GeneratedValue(strategy'AUTO')]
  30.     #[ORM\Column(type'integer')]
  31.     private ?int $id null;
  32.     #[ORM\Column(type'boolean')]
  33.     #[Assert\IsTrue(message'participant.unconfirmed'groups: ['full_apply'])]
  34.     private bool $confirmed false;
  35.     #[ORM\ManyToOne(targetEntity'App\Entity\Olympiad\Online\Event')]
  36.     #[ORM\JoinColumn(nullablefalse)]
  37.     private Event $event;
  38.     /**
  39.      * @var string
  40.      */
  41.     #[ORM\Column(type'string')]
  42.     #[Assert\NotBlank(groups: ['full_apply''Default'])]
  43.     private string $firstName;
  44.     /**
  45.      * @var string|null
  46.      *
  47.      */
  48.     #[ORM\Column(type'string'nullabletrue)]
  49.     private ?string $middleName null;
  50.     /**
  51.      * @var string
  52.      */
  53.     #[ORM\Column(type'string')]
  54.     #[Assert\NotBlank(groups: ['full_apply''Default'])]
  55.     private string $lastName;
  56.     /**
  57.      * @var string|null
  58.      */
  59.     #[ORM\Column(type'string'length50nullabletrue)]
  60.     #[Assert\NotBlank(groups: ['russian_apply''russian_passport'])]
  61.     private ?string $phone null;
  62.     /**
  63.      * @var string|null
  64.      */
  65.     #[ORM\Column(type'string'length50nullabletrue)]
  66.     #[Assert\NotBlank(groups: ['full_apply''Default'])]
  67.     #[Assert\Email(groups: ['full_apply''Default'])]
  68.     private ?string $email null;
  69.     /**
  70.      * @var Country|null
  71.      */
  72.     #[ORM\ManyToOne(targetEntity'App\Entity\Common\Country')]
  73.     #[ORM\JoinColumn(nullabletrue)]
  74.     #[Assert\NotBlank(groups: ['full_apply''Default'])]
  75.     private ?Country $country null;
  76.     #[ORM\ManyToOne(targetEntity'App\Entity\Geo\Region')]
  77.     #[Assert\NotBlank(groups: ['russian_apply''russian_passport'])]
  78.     private ?Region $region;
  79.     #[ORM\Embedded(class: 'App\Entity\Common\Passport'columnPrefix'p_')]
  80.     #[Assert\Valid(groups: ['russian_passport''russian_apply''full_apply''Default''russian_attendant''foreign_attendant'])]
  81.     #[Assert\NotBlank(groups: ['Default'], message'passport.fill')]
  82.     private Passport $passport;
  83.     #[ORM\Column(type'string'nullabletrue)]
  84.     #[Assert\NotBlank(groups: ['full_apply''Default'])]
  85.     private ?string $education;
  86.     /**
  87.      * @var string|null
  88.      */
  89.     #[ORM\Column(type'text'nullabletrue)]
  90.     #[Assert\NotBlank(groups: ['full_apply''Default'])]
  91.     private ?string $addressRegistration null;
  92.     /**
  93.      * @var string|null
  94.      */
  95.     #[ORM\Column(type'text'nullabletrue)]
  96.     #[Assert\NotBlank(groups: ['full_apply''Default'])]
  97.     private ?string $addressFact null;
  98.     /**
  99.      * @var bool
  100.      */
  101.     #[ORM\Column(type'boolean'nullablefalsename'is_test_data'options: ['default' => 0])]
  102.     private bool $test_data false;
  103.     /**
  104.      * @var string|null
  105.      */
  106.     #[ORM\Column(type'string'nullabletrue)]
  107.     #[Assert\NotBlank(groups: ['full_apply''Default'])]
  108.     private ?string $workPlace null;
  109.     /**
  110.      * @var string|null
  111.      */
  112.     #[ORM\Column(type'string'nullabletrue)]
  113.     #[Assert\NotBlank(groups: ['full_apply''Default'])]
  114.     private ?string $workPosition null;
  115.     /**
  116.      * @var Collection
  117.      */
  118.     #[ORM\OneToMany(targetEntity'App\Entity\Olympiad\Online\Attendant\AttendantParticipant'mappedBy'attendant')]
  119.     private Collection $participants;
  120.     /**
  121.      * @var ?\DateTime
  122.      */
  123.     #[ORM\Column(type'date'nullabletrue)]
  124.     #[Assert\NotBlank(groups: ['full_apply''Default'])]
  125.     #[Assert\GreaterThan('-110 years'groups: ['Default''full_apply'])]
  126.     #[Assert\LessThan('-10 years'groups: ['Default''full_apply'])]
  127.     private ?\Datetime $birthday null;
  128.     #[ORM\Column(type'text'nullabletrue)]
  129.     private ?string $allergy '';
  130.     public function __construct()
  131.     {
  132.         $this->participants = new ArrayCollection();
  133.     }
  134.     /**
  135.      * @return int|null
  136.      */
  137.     public function getId(): ?int
  138.     {
  139.         return $this->id;
  140.     }
  141.     /**
  142.      * @param int|null $id
  143.      */
  144.     public function setId(?int $id): void
  145.     {
  146.         $this->id $id;
  147.     }
  148.     /**
  149.      * @return bool
  150.      */
  151.     public function isConfirmed(): bool
  152.     {
  153.         return $this->confirmed;
  154.     }
  155.     /**
  156.      * @param bool $confirmed
  157.      */
  158.     public function setConfirmed(bool $confirmed): void
  159.     {
  160.         $this->confirmed $confirmed;
  161.     }
  162.     /**
  163.      * @return string
  164.      */
  165.     public function getFirstName(): string
  166.     {
  167.         return $this->firstName;
  168.     }
  169.     /**
  170.      * @param string $firstName
  171.      */
  172.     public function setFirstName(string $firstName): void
  173.     {
  174.         $this->firstName $firstName;
  175.     }
  176.     /**
  177.      * @return string|null
  178.      */
  179.     public function getMiddleName(): ?string
  180.     {
  181.         return $this->middleName;
  182.     }
  183.     /**
  184.      * @param string|null $middleName
  185.      */
  186.     public function setMiddleName(?string $middleName): void
  187.     {
  188.         $this->middleName $middleName;
  189.     }
  190.     /**
  191.      * @return string
  192.      */
  193.     public function getLastName(): string
  194.     {
  195.         return $this->lastName;
  196.     }
  197.     /**
  198.      * @param string $lastName
  199.      */
  200.     public function setLastName(string $lastName): void
  201.     {
  202.         $this->lastName $lastName;
  203.     }
  204.     /**
  205.      * @return string|null
  206.      */
  207.     public function getPhone(): ?string
  208.     {
  209.         return $this->phone;
  210.     }
  211.     /**
  212.      * @param string|null $phone
  213.      */
  214.     public function setPhone(?string $phone): void
  215.     {
  216.         $this->phone $phone;
  217.     }
  218.     /**
  219.      * @return string|null
  220.      */
  221.     public function getEmail(): ?string
  222.     {
  223.         return $this->email;
  224.     }
  225.     /**
  226.      * @param string|null $email
  227.      */
  228.     public function setEmail(?string $email): void
  229.     {
  230.         $this->email $email;
  231.     }
  232.     /**
  233.      * @return Country|null
  234.      */
  235.     public function getCountry(): ?Country
  236.     {
  237.         return $this->country;
  238.     }
  239.     /**
  240.      * @param Country|null $country
  241.      */
  242.     public function setCountry(?Country $country): void
  243.     {
  244.         $this->country $country;
  245.     }
  246.     /**
  247.      * @return Region|null
  248.      */
  249.     public function getRegion(): ?Region
  250.     {
  251.         return $this->region;
  252.     }
  253.     /**
  254.      * @param Region|null $region
  255.      */
  256.     public function setRegion(?Region $region): void
  257.     {
  258.         $this->region $region;
  259.     }
  260.     /**
  261.      * @return Passport
  262.      */
  263.     public function getPassport(): Passport
  264.     {
  265.         return $this->passport;
  266.     }
  267.     /**
  268.      * @param Passport $passport
  269.      */
  270.     public function setPassport(Passport $passport): void
  271.     {
  272.         $this->passport $passport;
  273.     }
  274.     /**
  275.      * @return string|null
  276.      */
  277.     public function getEducation(): ?string
  278.     {
  279.         return $this->education;
  280.     }
  281.     /**
  282.      * @param string|null $education
  283.      */
  284.     public function setEducation(?string $education): void
  285.     {
  286.         $this->education $education;
  287.     }
  288.     /**
  289.      * @return string|null
  290.      */
  291.     public function getAddressRegistration(): ?string
  292.     {
  293.         return $this->addressRegistration;
  294.     }
  295.     /**
  296.      * @param string|null $addressRegistration
  297.      */
  298.     public function setAddressRegistration(?string $addressRegistration): void
  299.     {
  300.         $this->addressRegistration $addressRegistration;
  301.     }
  302.     /**
  303.      * @return string|null
  304.      */
  305.     public function getAddressFact(): ?string
  306.     {
  307.         return $this->addressFact;
  308.     }
  309.     /**
  310.      * @param string|null $addressFact
  311.      */
  312.     public function setAddressFact(?string $addressFact): void
  313.     {
  314.         $this->addressFact $addressFact;
  315.     }
  316.     /**
  317.      * @return bool
  318.      */
  319.     public function isTestData(): bool
  320.     {
  321.         return $this->test_data;
  322.     }
  323.     /**
  324.      * @param bool $test_data
  325.      */
  326.     public function setTestData(bool $test_data): void
  327.     {
  328.         $this->test_data $test_data;
  329.     }
  330.     /**
  331.      * @return string|null
  332.      */
  333.     public function getWorkPlace(): ?string
  334.     {
  335.         return $this->workPlace;
  336.     }
  337.     /**
  338.      * @param string|null $workPlace
  339.      */
  340.     public function setWorkPlace(?string $workPlace): void
  341.     {
  342.         $this->workPlace $workPlace;
  343.     }
  344.     /**
  345.      * @return string|null
  346.      */
  347.     public function getWorkPosition(): ?string
  348.     {
  349.         return $this->workPosition;
  350.     }
  351.     /**
  352.      * @param string|null $workPosition
  353.      */
  354.     public function setWorkPosition(?string $workPosition): void
  355.     {
  356.         $this->workPosition $workPosition;
  357.     }
  358.     /**
  359.      * @return Event
  360.      */
  361.     public function getEvent(): Event
  362.     {
  363.         return $this->event;
  364.     }
  365.     /**
  366.      * @param Event $event
  367.      */
  368.     public function setEvent(Event $event): void
  369.     {
  370.         $this->event $event;
  371.     }
  372.     /**
  373.      * @return User|null
  374.      */
  375.     public function getUser(): ?User
  376.     {
  377.         return $this->user;
  378.     }
  379.     /**
  380.      * @param User|null $user
  381.      */
  382.     public function setUser(?User $user): void
  383.     {
  384.         $this->user $user;
  385.     }
  386.     /**
  387.      * @return bool
  388.      */
  389.     public function isCanceled(): bool
  390.     {
  391.         return $this->canceled;
  392.     }
  393.     /**
  394.      * @param bool $canceled
  395.      */
  396.     public function setCanceled(bool $canceled): void
  397.     {
  398.         $this->canceled $canceled;
  399.     }
  400.     /**
  401.      * @return string
  402.      */
  403.     public function getUuid(): string
  404.     {
  405.         return $this->uuid;
  406.     }
  407.     /**
  408.      * @param string $uuid
  409.      */
  410.     public function setUuid(string $uuid): void
  411.     {
  412.         $this->uuid $uuid;
  413.     }
  414.     /**
  415.      * @return Collection
  416.      */
  417.     public function getParticipants()
  418.     {
  419.         return $this->participants;
  420.     }
  421.     /**
  422.      * @param Collection $participants
  423.      */
  424.     public function setParticipants($participants): void
  425.     {
  426.         $this->participants $participants;
  427.     }
  428.     /**
  429.      * @return \DateTime|null
  430.      */
  431.     public function getBirthday(): ?\Datetime
  432.     {
  433.         return $this->birthday;
  434.     }
  435.     /**
  436.      * @param \DateTime|null $birthday
  437.      */
  438.     public function setBirthday(?\Datetime $birthday): void
  439.     {
  440.         $this->birthday $birthday;
  441.     }
  442.     /**
  443.      * @return string|null
  444.      */
  445.     public function getAllergy(): ?string
  446.     {
  447.         return $this->allergy;
  448.     }
  449.     /**
  450.      * @param string|null $allergy
  451.      */
  452.     public function setAllergy(?string $allergy): void
  453.     {
  454.         $this->allergy $allergy;
  455.     }
  456. }