<?php
namespace App\Entity;
use Boab\CmsBundle\Entity\Content;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Boab\CmsBundle\Repository\ContentRepository;
/**
* @ORM\Entity(repositoryClass=ContentRepository::class)
*/
class Artist extends Content implements ArtistInterface
{
/**
* @ORM\Column(type="string", length=255)
*/
private $genre;
/**
* @ORM\OneToMany(targetEntity=Audio::class, mappedBy="artist", orphanRemoval=true)
*/
private $audios;
public function __construct()
{
parent::__construct();
$this->audios = new ArrayCollection();
}
public function getGenre(): ?string
{
return $this->genre;
}
public function setGenre(string $genre): self
{
$this->genre = $genre;
return $this;
}
/**
* @return Collection<int, Audio>
*/
public function getAudios(): Collection
{
return $this->audios;
}
public function addAudio(Audio $audio): self
{
if (!$this->audios->contains($audio)) {
$this->audios[] = $audio;
$audio->setArtist($this);
}
return $this;
}
public function removeAudio(Audio $audio): self
{
if ($this->audios->removeElement($audio)) {
// set the owning side to null (unless already changed)
if ($audio->getArtist() === $this) {
$audio->setArtist(null);
}
}
return $this;
}
}