<?php namespace App\Entity;use App\Repository\HymnCategoryRepository;use DateTime;use Doctrine\Common\Collections\{ArrayCollection, Collection};use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;/** * HymnCategory * * @ORM\Table(name="hymn_category") * @ORM\Entity(repositoryClass=HymnCategoryRepository::class) */class HymnCategory{ /** * @var int * * @ORM\Column(type="integer", name="id", options={"unsigned":true}) * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") */ private int $id; /** * @ORM\Column(type="string", length=255) */ private string $title; /** * @Gedmo\Slug(fields={"title","slug"}) * @ORM\Column(type="string", length=128) */ private string $slug; /** * @ORM\Column(type="text", nullable=true) */ private string $description; /** * @ORM\Column(type="datetime", nullable=true) */ private DateTime $created_at; /** * @ORM\ManyToMany(targetEntity="App\Entity\Hymns", mappedBy="category") * @ORM\OrderBy({"title" = "ASC"}) */ protected Collection $hymns; /** * HymnCategory constructor * * @return void */ public function __construct() { $this->hymns = new ArrayCollection(); $this->setCreatedAt(new DateTime('now')); } /** * @return int|null */ public function getId(): ?int { return $this->id; } /** * @param int $id * @return HymnCategory */ public function setId(int $id): HymnCategory { $this->id = $id; return $this; } /** * @return string|null */ public function getTitle(): ?string { return $this->title; } /** * @param string $title * @return $this */ public function setTitle(string $title): self { $this->title = $title; return $this; } /** * @return string|null */ public function getSlug(): ?string { return $this->slug; } /** * @param string $slug * @return $this */ public function setSlug(string $slug): self { $this->slug = $slug; return $this; } /** * @return string|null */ public function getDescription(): ?string { return $this->description; } /** * @param string $description * @return $this */ public function setDescription(string $description): self { $this->description = $description; return $this; } /** * @return DateTime|null */ public function getCreatedAt(): ?DateTime { return $this->created_at; } /** * @param DateTime $created_at * @return $this */ public function setCreatedAt(DateTime $created_at): self { $this->created_at = $created_at; return $this; } /** * @return Collection */ public function getHymns(): Collection { return $this->hymns; } /** * @param Collection $hymns * @return $this */ public function setHymns(Collection $hymns): self { if(!$this->hymns->contains($hymns)) { $this->hymns = $hymns; } return $this; }}