<?phpnamespace App\Entity\Gos;use App\Repository\Gos\EventFormulaRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=EventFormulaRepository::class) * @ORM\HasLifecycleCallbacks */class EventFormula{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\Column(type="datetime", nullable=true) */ private $updatedAt; /** * @ORM\OneToMany(targetEntity=Events::class, mappedBy="eventFormula") */ private $events; public function __construct() { $this->events = new ArrayCollection(); } /** @ORM\PrePersist() */ public function prePersist() { $this->createdAt = new \DateTime(); } /** @ORM\PreUpdate() */ public function preUpdate() { $this->updatedAt = new \DateTime(); } public function __toString() { return (string)$this->name; } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; 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 Collection|Events[] */ public function getEvents(): Collection { return $this->events; } public function addEvent(Events $event): self { if (!$this->events->contains($event)) { $this->events[] = $event; $event->setEventFormula($this); } return $this; } public function removeEvent(Events $event): self { if ($this->events->contains($event)) { $this->events->removeElement($event); // set the owning side to null (unless already changed) if ($event->getEventFormula() === $this) { $event->setEventFormula(null); } } return $this; }}