<?phpnamespace App\Entity;use App\Repository\VisioEventPromotionRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;use Symfony\Component\Validator\Constraints as Assert;/** * Refers to the token available to a company * @ORM\Entity(repositoryClass=VisioEventPromotionRepository::class) * @ORM\HasLifecycleCallbacks */class VisioEventPromotion{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * Libellé de l'opération * @var string|null * @ORM\Column(type="string", length=255) * @Assert\NotBlank */ private $name; /** * @ORM\ManyToOne(targetEntity=Company::class, inversedBy="visioEventPromotions") */ private $company; /** * @ORM\ManyToOne(targetEntity=Tag::class, inversedBy="visioEventPromotions") */ private $tag; /** * @ORM\Column(type="datetime") */ private $start; /** * @ORM\Column(type="datetime") */ private $end; /** * @ORM\Column(type="datetime") * @Gedmo\Timestampable(on="create") */ private $createdAt; /** * @ORM\Column(type="datetime") * @Gedmo\Timestampable(on="update") */ private $updatedAt; /** * @ORM\ManyToMany(targetEntity=Specialist::class, inversedBy="visioEventPromotions") */ private $specialists; /** * @ORM\Column(type="integer") */ private $originalTokenAmount; /** * @ORM\Column(type="integer") */ private $currentTokenAmount; /** * @ORM\Column(type="integer") */ private $tokensPerEmployee = 1; /** * @ORM\OneToMany(targetEntity=Registration::class, mappedBy="token") */ private $registrations; public function __construct() { $this->createdAt = new \DateTime(); $this->start = new \DateTime(); $this->specialists = new ArrayCollection(); $this->registrations = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getCompany(): ?Company { return $this->company; } public function setCompany(?Company $company): self { $this->company = $company; return $this; } public function getTag(): ?Tag { return $this->tag; } public function setTag(?Tag $tag): self { $this->tag = $tag; return $this; } public function getStart(): ?\DateTimeInterface { return $this->start; } public function setStart(?\DateTimeInterface $start): self { $this->start = $start; return $this; } public function getEnd(): ?\DateTimeInterface { return $this->end; } public function setEnd(?\DateTimeInterface $end): self { $this->end = $end; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(?\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(\DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } /** * @return Specialist|null */ public function getSpecialist(): ?Specialist { return (!empty($this->specialists->toArray())) ? $this->specialists->toArray()[0] : null; } /** * @return Collection<int, Specialist> */ public function getSpecialists(): Collection { return $this->specialists; } public function addSpecialist(Specialist $specialist): self { if (!$this->specialists->contains($specialist)) { $this->specialists[] = $specialist; } return $this; } public function removeSpecialist(Specialist $specialist): self { $this->specialists->removeElement($specialist); return $this; } public function getOriginalTokenAmount(): ?int { return $this->originalTokenAmount; } public function setOriginalTokenAmount(int $originalTokenAmount): self { $this->originalTokenAmount = $originalTokenAmount; return $this; } public function getCurrentTokenAmount(): ?int { return $this->currentTokenAmount; } public function setCurrentTokenAmount(int $currentTokenAmount): self { $this->currentTokenAmount = $currentTokenAmount; return $this; } public function getTokensPerEmployee(): ?int { return $this->tokensPerEmployee; } public function setTokensPerEmployee(int $tokensPerEmployee): self { $this->tokensPerEmployee = $tokensPerEmployee; return $this; } /** * @return Collection<int, Registration> */ public function getRegistrations(): Collection { return $this->registrations; } public function addRegistration(Registration $registration): self { if (!$this->registrations->contains($registration)) { $this->registrations[] = $registration; $registration->setToken($this); } return $this; } public function removeRegistration(Registration $registration): self { if ($this->registrations->removeElement($registration)) { // set the owning side to null (unless already changed) if ($registration->getToken() === $this) { $registration->setToken(null); } } return $this; } /** * @return string|null */ public function getName(): ?string { return $this->name; } /** * @param string|null $name * @return VisioEventPromotion */ public function setName(?string $name): VisioEventPromotion { $this->name = $name; return $this; }}