<?phpnamespace App\Entity\Gos;use App\Repository\Gos\CalendarEventKindRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;/** * @ORM\Entity(repositoryClass=CalendarEventKindRepository::class) * @ORM\HasLifecycleCallbacks() */class CalendarEventKind{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\Column(type="string", length=191, unique=true) * @Gedmo\Slug(fields={"name"}) */ private $slug; /** * @ORM\Column(type="string", length=255) */ private $color; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\Column(type="datetime", nullable=true) */ private $updatedAt; /** * @ORM\OneToMany(targetEntity=CalendarEvent::class, mappedBy="calendarEventKind") */ private $calendarEvents; public function __construct() { $this->calendarEvents = new ArrayCollection(); } /** @ORM\PrePersist() */ public function onPrePersist() { $this->createdAt = new \DateTime(); } /** @ORM\PreUpdate() */ public function onPreUpdate() { $this->updatedAt = new \DateTime(); } 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 getSlug(): ?string { return $this->slug; } public function setSlug(string $slug): self { $this->slug = $slug; return $this; } public function getColor(): ?string { return $this->color; } public function setColor(string $color): self { $this->color = $color; 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|CalendarEvent[] */ public function getCalendarEvents(): Collection { return $this->calendarEvents; } public function addCalendarEvent(CalendarEvent $calendarEvent): self { if (!$this->calendarEvents->contains($calendarEvent)) { $this->calendarEvents[] = $calendarEvent; $calendarEvent->setCalendarEventKind($this); } return $this; } public function removeCalendarEvent(CalendarEvent $calendarEvent): self { if ($this->calendarEvents->contains($calendarEvent)) { $this->calendarEvents->removeElement($calendarEvent); // set the owning side to null (unless already changed) if ($calendarEvent->getCalendarEventKind() === $this) { $calendarEvent->setCalendarEventKind(null); } } return $this; }}