<?php namespace App\Entity;
use DateTime;
use DateTimeInterface;
use Doctrine\Common\Collections\{ArrayCollection, Collection};
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* Hymntypes
*
* @ORM\Table(name="hymntypes")
* @ORM\Entity
*/
class Hymntypes
{
/**
* @var int
*
* @ORM\Column(type="integer", name="id")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private int $id;
/**
* @var string
*
* @ORM\Column(type="string", length=255, nullable=false, name="title")
*/
private string $title;
/**
* @Gedmo\Slug(fields={"title","slug"})
* @ORM\Column(unique=true, length=128, nullable=false)
*/
private ?string $slug;
/**
* @var string|null
*
* @ORM\Column(type="text", length=65535, nullable=true, name="description")
*/
private ?string $description;
/**
* @var DateTime|null
*
* @ORM\Column(type="datetime", nullable=true, name="created_at")
*/
private ?DateTime $created_at;
/**
* @var DateTime|null
*
* @ORM\Column(type="datetime", nullable=true, name="updated_at")
*/
private ?DateTime $updated_at;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Hymns", mappedBy="type", cascade={"persist"})
* @ORM\JoinColumn(nullable=false, referencedColumnName="id")
*/
private Collection $hymns;
/**
* Hymntypes constructor.
*/
public function __construct()
{
$this->hymns = new ArrayCollection();
}
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @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|null $description
*
* @return $this
*/
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return DateTimeInterface|null
*/
public function getCreatedAt(): ?DateTimeInterface
{
return $this->created_at;
}
/**
* @param DateTimeInterface|null $created_at
*
* @return $this
*/
public function setCreatedAt(?DateTimeInterface $created_at): self
{
$this->created_at = $created_at;
return $this;
}
/**
* @return DateTimeInterface|null
*/
public function getUpdatedAt(): ?DateTimeInterface
{
return $this->updated_at;
}
/**
* @param DateTimeInterface|null $updated_at
*
* @return $this
*/
public function setUpdatedAt(?DateTimeInterface $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
/**
* @return Collection
*/
public function getHymns(): Collection
{
return $this->hymns;
}
/**
* @param Hymns $hymn
*
* @return $this
*/
public function addHymn(Hymns $hymn): self
{
if (! $this->hymns->contains($hymn)) {
$this->hymns[] = $hymn;
$hymn->setType($this);
}
return $this;
}
/**
* @param Hymns $hymn
*
* @return $this
*/
public function removeHymn(Hymns $hymn): self
{
if ($this->hymns->contains($hymn)) {
$this->hymns->removeElement($hymn);
// set the owning side to null (unless already changed)
if ($hymn->getType() === $this) {
$hymn->setType(null);
}
}
return $this;
}
/**
* @return string
*/
public function __toString()
{
return (string) $this->getTitle();
}
}