src/Entity/Gos/Participants.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Entity\Gos\Uniqskills\UserCertificate;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table()
  9.  * @ORM\Entity(repositoryClass="App\Repository\ParticipantsRepository")
  10.  * @ORM\HasLifecycleCallbacks()
  11.  */
  12. class Participants
  13. {
  14.     /**
  15.      * @ORM\Id()
  16.      * @ORM\GeneratedValue()
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\Orders", inversedBy="participants")
  22.      */
  23.     private $orders;
  24.     /**
  25.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\ProductVariant", inversedBy="participantsPrimary")
  26.      * @ORM\JoinColumn()
  27.      */
  28.     private $primaryProductVariant;
  29.     /**
  30.      * @ORM\Column(type="string", length=255, nullable=true)
  31.      */
  32.     private $firstName;
  33.     /**
  34.      * @ORM\Column(type="string", length=255, nullable=true)
  35.      */
  36.     private $lastName;
  37.     /**
  38.      * @ORM\Column(type="string", length=30, nullable=true)
  39.      */
  40.     private $phoneNumber;
  41.     /**
  42.      * @ORM\Column(type="string", length=255)
  43.      */
  44.     private $email;
  45.     /**
  46.      * @ORM\Column(type="string", length=255, nullable=true)
  47.      */
  48.     private $position;
  49.     /**
  50.      * @ORM\Column(type="datetime")
  51.      */
  52.     private $createdAt;
  53.     /**
  54.      * @ORM\Column(type="datetime", nullable=true)
  55.      */
  56.     private $updatedAt;
  57.     /**
  58.      * @ORM\Column(type="string", length=255, nullable=true)
  59.      */
  60.     private $address;
  61.     /**
  62.      * @ORM\Column(type="string", length=255, nullable=true)
  63.      */
  64.     private $postalCode;
  65.     /**
  66.      * @ORM\Column(type="string", length=255, nullable=true)
  67.      */
  68.     private $city;
  69.     /**
  70.      * @ORM\OneToMany(targetEntity=UserCertificate::class, mappedBy="participant")
  71.      */
  72.     private $userCertificate;
  73.     /**
  74.      * @ORM\Column(type="boolean", nullable=true)
  75.      */
  76.     private $productDuplicationMessageDisplayed;
  77.     /**
  78.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\OrderProductVariant", mappedBy="participant")
  79.      */
  80.     private $orderProductVariants;
  81.     public function isSamePerson(self $other): bool
  82.     {
  83.         return $this->email === $other->email
  84.             && $this->firstName === $other->firstName
  85.             && $this->lastName === $other->lastName
  86.             && $this->phoneNumber === $other->phoneNumber;
  87.     }
  88.     /**
  89.      * Participants constructor.
  90.      */
  91.     public function __construct()
  92.     {
  93.         $this->createdAt = new \DateTime();
  94.         $this->userCertificate = new ArrayCollection();
  95.         $this->orderProductVariants = new ArrayCollection();
  96.     }
  97.     /** @ORM\PrePersist() */
  98.     public function prePersist()
  99.     {
  100.         $this->createdAt = new \DateTime();
  101.     }
  102.     /** @ORM\PreUpdate() */
  103.     public function preUpdate()
  104.     {
  105.         $this->updatedAt = new \DateTime();
  106.     }
  107.     /**
  108.      * @return array
  109.      */
  110.     public function getObjectVars()
  111.     {
  112.         return get_object_vars($this);
  113.     }
  114.     /**
  115.      * @return mixed
  116.      */
  117.     public function getId()
  118.     {
  119.         return $this->id;
  120.     }
  121.     /**
  122.      * @param mixed $id
  123.      */
  124.     public function setId($id): void
  125.     {
  126.         $this->id $id;
  127.     }
  128.     /**
  129.      * @return mixed
  130.      */
  131.     public function getOrders()
  132.     {
  133.         return $this->orders;
  134.     }
  135.     /**
  136.      * @param mixed $orders
  137.      */
  138.     public function setOrders($orders): void
  139.     {
  140.         $this->orders $orders;
  141.     }
  142.     /**
  143.      * @return mixed
  144.      */
  145.     public function getPrimaryProductVariant()
  146.     {
  147.         return $this->primaryProductVariant;
  148.     }
  149.     /**
  150.      * @param mixed $primaryProductVariant
  151.      */
  152.     public function setPrimaryProductVariant($primaryProductVariant): void
  153.     {
  154.         $this->primaryProductVariant $primaryProductVariant;
  155.     }
  156.     /**
  157.      * @return mixed
  158.      */
  159.     public function getFirstName()
  160.     {
  161.         return $this->firstName;
  162.     }
  163.     /**
  164.      * @param mixed $firstName
  165.      */
  166.     public function setFirstName($firstName): void
  167.     {
  168.         $this->firstName $firstName;
  169.     }
  170.     /**
  171.      * @return mixed
  172.      */
  173.     public function getLastName()
  174.     {
  175.         return $this->lastName;
  176.     }
  177.     /**
  178.      * @param mixed $lastName
  179.      */
  180.     public function setLastName($lastName): void
  181.     {
  182.         $this->lastName $lastName;
  183.     }
  184.     /**
  185.      * @return mixed
  186.      */
  187.     public function getPhoneNumber()
  188.     {
  189.         return $this->phoneNumber;
  190.     }
  191.     /**
  192.      * @param mixed $phoneNumber
  193.      */
  194.     public function setPhoneNumber($phoneNumber): void
  195.     {
  196.         $this->phoneNumber $phoneNumber;
  197.     }
  198.     /**
  199.      * @return mixed
  200.      */
  201.     public function getEmail()
  202.     {
  203.         return $this->email;
  204.     }
  205.     /**
  206.      * @param mixed $email
  207.      */
  208.     public function setEmail($email): void
  209.     {
  210.         $this->email $email;
  211.     }
  212.     /**
  213.      * @return mixed
  214.      */
  215.     public function getPosition()
  216.     {
  217.         return $this->position;
  218.     }
  219.     /**
  220.      * @param mixed $position
  221.      */
  222.     public function setPosition($position): void
  223.     {
  224.         $this->position $position;
  225.     }
  226.     /**
  227.      * @return mixed
  228.      */
  229.     public function getCreatedAt()
  230.     {
  231.         return $this->createdAt;
  232.     }
  233.     /**
  234.      * @param mixed $createdAt
  235.      */
  236.     public function setCreatedAt($createdAt): void
  237.     {
  238.         $this->createdAt $createdAt;
  239.     }
  240.     /**
  241.      * @return mixed
  242.      */
  243.     public function getUpdatedAt()
  244.     {
  245.         return $this->updatedAt;
  246.     }
  247.     /**
  248.      * @param mixed $updatedAt
  249.      */
  250.     public function setUpdatedAt($updatedAt): void
  251.     {
  252.         $this->updatedAt $updatedAt;
  253.     }
  254.     public function getAddress(): ?string
  255.     {
  256.         return $this->address;
  257.     }
  258.     public function setAddress(?string $address): self
  259.     {
  260.         $this->address $address;
  261.         return $this;
  262.     }
  263.     public function getPostalCode(): ?string
  264.     {
  265.         return $this->postalCode;
  266.     }
  267.     public function setPostalCode(?string $postalCode): self
  268.     {
  269.         $this->postalCode $postalCode;
  270.         return $this;
  271.     }
  272.     public function getCity(): ?string
  273.     {
  274.         return $this->city;
  275.     }
  276.     public function setCity(?string $city): self
  277.     {
  278.         $this->city $city;
  279.         return $this;
  280.     }
  281.     /**
  282.      * @return Collection|UserCertificate[]
  283.      */
  284.     public function getUserCertificate(): Collection
  285.     {
  286.         return $this->userCertificate;
  287.     }
  288.     public function addUserCertificate(UserCertificate $userCertificate): self
  289.     {
  290.         if (!$this->userCertificate->contains($userCertificate)) {
  291.             $this->userCertificate[] = $userCertificate;
  292.             $userCertificate->setParticipant($this);
  293.         }
  294.         return $this;
  295.     }
  296.     public function removeUserCertificate(UserCertificate $userCertificate): self
  297.     {
  298.         if ($this->userCertificate->contains($userCertificate)) {
  299.             $this->userCertificate->removeElement($userCertificate);
  300.             // set the owning side to null (unless already changed)
  301.             if ($userCertificate->getParticipant() === $this) {
  302.                 $userCertificate->setParticipant(null);
  303.             }
  304.         }
  305.         return $this;
  306.     }
  307.     public function getProductDuplicationMessageDisplayed(): ?bool
  308.     {
  309.         return $this->productDuplicationMessageDisplayed;
  310.     }
  311.     public function setProductDuplicationMessageDisplayed(?bool $productDuplicationMessageDisplayed): self
  312.     {
  313.         $this->productDuplicationMessageDisplayed $productDuplicationMessageDisplayed;
  314.         return $this;
  315.     }
  316.     /**
  317.      * @return Collection|OrderProductVariant[]
  318.      */
  319.     public function getOrderProductVariants(): Collection
  320.     {
  321.         return $this->orderProductVariants;
  322.     }
  323.     public function addOrderProductVariant(OrderProductVariant $orderProductVariant): self
  324.     {
  325.         if (!$this->orderProductVariants->contains($orderProductVariant)) {
  326.             $this->orderProductVariants[] = $orderProductVariant;
  327.             $orderProductVariant->setParticipant($this);
  328.         }
  329.         return $this;
  330.     }
  331.     public function removeOrderProductVariant(OrderProductVariant $orderProductVariant): self
  332.     {
  333.         if ($this->orderProductVariants->contains($orderProductVariant)) {
  334.             $this->orderProductVariants->removeElement($orderProductVariant);
  335.             // set the owning side to null (unless already changed)
  336.             if ($orderProductVariant->getParticipant() === $this) {
  337.                 $orderProductVariant->setParticipant(null);
  338.             }
  339.         }
  340.         return $this;
  341.     }
  342. }