src/Entity/VisioEventPromotion.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\VisioEventPromotionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10.  * Refers to the token available to a company
  11.  * @ORM\Entity(repositoryClass=VisioEventPromotionRepository::class)
  12.  * @ORM\HasLifecycleCallbacks
  13.  */
  14. class VisioEventPromotion
  15. {
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * LibellĂ© de l'opĂ©ration
  24.      * @var string|null
  25.      * @ORM\Column(type="string", length=255)
  26.      * @Assert\NotBlank
  27.      */
  28.     private $name;
  29.     /**
  30.      * @ORM\ManyToOne(targetEntity=Company::class, inversedBy="visioEventPromotions")
  31.      */
  32.     private $company;
  33.     /**
  34.      * @ORM\ManyToOne(targetEntity=Tag::class, inversedBy="visioEventPromotions")
  35.      */
  36.     private $tag;
  37.     /**
  38.      * @ORM\Column(type="datetime")
  39.      */
  40.     private $start;
  41.     /**
  42.      * @ORM\Column(type="datetime")
  43.      */
  44.     private $end;
  45.     /**
  46.      * @ORM\Column(type="datetime")
  47.      * @Gedmo\Timestampable(on="create")
  48.      */
  49.     private $createdAt;
  50.     /**
  51.      * @ORM\Column(type="datetime")
  52.      * @Gedmo\Timestampable(on="update")
  53.      */
  54.     private $updatedAt;
  55.     /**
  56.      * @ORM\ManyToMany(targetEntity=Specialist::class, inversedBy="visioEventPromotions")
  57.      */
  58.     private $specialists;
  59.     /**
  60.      * @ORM\Column(type="integer")
  61.      */
  62.     private $originalTokenAmount;
  63.     /**
  64.      * @ORM\Column(type="integer")
  65.      */
  66.     private $currentTokenAmount;
  67.     /**
  68.      * @ORM\Column(type="integer")
  69.      */
  70.     private $tokensPerEmployee 1;
  71.     /**
  72.      * @ORM\OneToMany(targetEntity=Registration::class, mappedBy="token")
  73.      */
  74.     private $registrations;
  75.     public function __construct()
  76.     {
  77.         $this->createdAt = new \DateTime();
  78.         $this->start = new \DateTime();
  79.         $this->specialists = new ArrayCollection();
  80.         $this->registrations = new ArrayCollection();
  81.     }
  82.     public function getId(): ?int
  83.     {
  84.         return $this->id;
  85.     }
  86.     public function getCompany(): ?Company
  87.     {
  88.         return $this->company;
  89.     }
  90.     public function setCompany(?Company $company): self
  91.     {
  92.         $this->company $company;
  93.         return $this;
  94.     }
  95.     public function getTag(): ?Tag
  96.     {
  97.         return $this->tag;
  98.     }
  99.     public function setTag(?Tag $tag): self
  100.     {
  101.         $this->tag $tag;
  102.         return $this;
  103.     }
  104.     public function getStart(): ?\DateTimeInterface
  105.     {
  106.         return $this->start;
  107.     }
  108.     public function setStart(?\DateTimeInterface $start): self
  109.     {
  110.         $this->start $start;
  111.         return $this;
  112.     }
  113.     public function getEnd(): ?\DateTimeInterface
  114.     {
  115.         return $this->end;
  116.     }
  117.     public function setEnd(?\DateTimeInterface $end): self
  118.     {
  119.         $this->end $end;
  120.         return $this;
  121.     }
  122.     public function getCreatedAt(): ?\DateTimeInterface
  123.     {
  124.         return $this->createdAt;
  125.     }
  126.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  127.     {
  128.         $this->createdAt $createdAt;
  129.         return $this;
  130.     }
  131.     public function getUpdatedAt(): ?\DateTimeInterface
  132.     {
  133.         return $this->updatedAt;
  134.     }
  135.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  136.     {
  137.         $this->updatedAt $updatedAt;
  138.         return $this;
  139.     }
  140.     /**
  141.      * @return Specialist|null
  142.      */
  143.     public function getSpecialist(): ?Specialist
  144.     {
  145.         return (!empty($this->specialists->toArray())) ? $this->specialists->toArray()[0] : null;
  146.     }
  147.     /**
  148.      * @return Collection<int, Specialist>
  149.      */
  150.     public function getSpecialists(): Collection
  151.     {
  152.         return $this->specialists;
  153.     }
  154.     public function addSpecialist(Specialist $specialist): self
  155.     {
  156.         if (!$this->specialists->contains($specialist)) {
  157.             $this->specialists[] = $specialist;
  158.         }
  159.         return $this;
  160.     }
  161.     public function removeSpecialist(Specialist $specialist): self
  162.     {
  163.         $this->specialists->removeElement($specialist);
  164.         return $this;
  165.     }
  166.     public function getOriginalTokenAmount(): ?int
  167.     {
  168.         return $this->originalTokenAmount;
  169.     }
  170.     public function setOriginalTokenAmount(int $originalTokenAmount): self
  171.     {
  172.         $this->originalTokenAmount $originalTokenAmount;
  173.         return $this;
  174.     }
  175.     public function getCurrentTokenAmount(): ?int
  176.     {
  177.         return $this->currentTokenAmount;
  178.     }
  179.     public function setCurrentTokenAmount(int $currentTokenAmount): self
  180.     {
  181.         $this->currentTokenAmount $currentTokenAmount;
  182.         return $this;
  183.     }
  184.     public function getTokensPerEmployee(): ?int
  185.     {
  186.         return $this->tokensPerEmployee;
  187.     }
  188.     public function setTokensPerEmployee(int $tokensPerEmployee): self
  189.     {
  190.         $this->tokensPerEmployee $tokensPerEmployee;
  191.         return $this;
  192.     }
  193.     /**
  194.      * @return Collection<int, Registration>
  195.      */
  196.     public function getRegistrations(): Collection
  197.     {
  198.         return $this->registrations;
  199.     }
  200.     public function addRegistration(Registration $registration): self
  201.     {
  202.         if (!$this->registrations->contains($registration)) {
  203.             $this->registrations[] = $registration;
  204.             $registration->setToken($this);
  205.         }
  206.         return $this;
  207.     }
  208.     public function removeRegistration(Registration $registration): self
  209.     {
  210.         if ($this->registrations->removeElement($registration)) {
  211.             // set the owning side to null (unless already changed)
  212.             if ($registration->getToken() === $this) {
  213.                 $registration->setToken(null);
  214.             }
  215.         }
  216.         return $this;
  217.     }
  218.     /**
  219.      * @return string|null
  220.      */
  221.     public function getName(): ?string
  222.     {
  223.         return $this->name;
  224.     }
  225.     /**
  226.      * @param string|null $name
  227.      * @return VisioEventPromotion
  228.      */
  229.     public function setName(?string $name): VisioEventPromotion
  230.     {
  231.         $this->name $name;
  232.         return $this;
  233.     }
  234. }