<?phpnamespace App\Entity;use App\Repository\CategoryEventRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use JMS\Serializer\Annotation\Groups;use App\Entity\Traits\Timestampable;#[ORM\Entity(repositoryClass: CategoryEventRepository::class)]#[ORM\HasLifecycleCallbacks]class CategoryEvent{ use Timestampable; #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] #[Groups(['getEvent'])] private ?int $id = null; #[ORM\Column(length: 255)] #[Groups(['getEvent'])] private ?string $name = null; #[ORM\OneToMany(mappedBy: 'categoryEvent', targetEntity: Event::class)] private Collection $event; #[ORM\ManyToOne(inversedBy: 'categoryEvents', cascade: ["persist"])] private ?User $author = null; #[ORM\ManyToOne(inversedBy: 'categoryEventsEdited', cascade: ["persist"])] private ?User $editor = null; #[ORM\ManyToOne(inversedBy: 'categoryEvents', cascade: ["persist"])] #[ORM\JoinColumn(nullable: false)] private ?School $school = null; public function __construct() { $this->event = new ArrayCollection(); } public function __toString():string { return $this->name; } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): static { $this->name = $name; return $this; } /** * @return Collection<int, Event> */ public function getEvent(): Collection { return $this->event; } public function addEvent(Event $event): static { if (!$this->event->contains($event)) { $this->event->add($event); $event->setCategoryEvent($this); } return $this; } public function removeEvent(Event $event): static { if ($this->event->removeElement($event)) { // set the owning side to null (unless already changed) if ($event->getCategoryEvent() === $this) { $event->setCategoryEvent(null); } } return $this; } public function getAuthor(): ?User { return $this->author; } public function setAuthor(?User $author): static { $this->author = $author; return $this; } public function getEditor(): ?User { return $this->editor; } public function setEditor(?User $editor): static { $this->editor = $editor; return $this; } public function getSchool(): ?School { return $this->school; } public function setSchool(?School $school): static { $this->school = $school; return $this; }}