src/Entity/Category.php line 13
<?phpnamespace App\Entity;use App\Repository\CategoryRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;use Gedmo\Translatable\Translatable;#[ORM\Entity(repositoryClass: CategoryRepository::class)]class Category implements Translatable{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[Gedmo\Translatable]#[ORM\Column(length: 255)]private ?string $title = null;#[ORM\OneToMany(mappedBy: 'category', targetEntity: WarEvent::class)]#[ORM\OrderBy(['date' => 'ASC'])]private Collection $warEvents;#[Gedmo\Locale]private string $locale = '';#[ORM\Column(length: 255)]private ?string $slug = null;#[ORM\Column(nullable: true)]private ?int $weight = null;public function __construct(){$this->warEvents = new ArrayCollection();}public static function new(): Category{return new Category();}public function getId(): ?int{return $this->id;}public function getTitle(): ?string{return $this->title;}public function setTitle(string $title): self{$this->title = $title;return $this;}/*** @return Collection<int, WarEvent>*/public function getWarEvents(): Collection{return $this->warEvents;}public function addWarEvent(WarEvent $warEvent): self{if (!$this->warEvents->contains($warEvent)) {$this->warEvents->add($warEvent);$warEvent->setCategory($this);}return $this;}public function removeWarEvent(WarEvent $warEvent): self{if ($this->warEvents->removeElement($warEvent)) {// set the owning side to null (unless already changed)if ($warEvent->getCategory() === $this) {$warEvent->setCategory(null);}}return $this;}public function __toString(): string{return strval($this->title);}public function setTranslatableLocale($locale){$this->locale = $locale;}public function getLocale(): string{return $this->locale;}public function getSlug(): ?string{return $this->slug;}public function setSlug(string $slug): self{$this->slug = $slug;return $this;}public function filterWarEvents(): self{$this->warEvents = $this->warEvents->filter(function (WarEvent $event) {return $event->isVisible();});return $this;}public function getWeight(): ?int{return $this->weight;}public function setWeight(?int $weight): self{$this->weight = $weight;return $this;}}