<?phpnamespace App\Entity;use App\Entity\Product;use App\Repository\CdRepository;use Doctrine\ORM\Mapping as ORM;use Doctrine\Common\Collections\Collection;use Doctrine\Common\Collections\ArrayCollection;/** * @ORM\Entity(repositoryClass=CdRepository::class) */class Cd extends Product{ /** * @ORM\ManyToOne(targetEntity=Label::class, inversedBy="cds") * @ORM\JoinColumn(nullable=false) */ private $label; /** * @ORM\ManyToMany(targetEntity=Style::class, inversedBy="cds") */ private $styles; /** * @ORM\Column(type="smallint") */ private $year; /** * @ORM\ManyToMany(targetEntity=Artist::class, inversedBy="cds") */ private $artists; /** * @ORM\Column(type="string", length=255) */ private $state; public function __construct() { $this->styles = new ArrayCollection(); $this->artists = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getLabel(): ?Label { return $this->label; } public function setLabel(?Label $label): self { $this->label = $label; return $this; } /** * @return Collection|Style[] */ public function getStyles(): Collection { return $this->styles; } public function addStyle(Style $style): self { if (!$this->styles->contains($style)) { $this->styles[] = $style; } return $this; } public function removeStyle(Style $style): self { $this->styles->removeElement($style); return $this; } public function getYear(): ?int { return $this->year; } public function setYear(int $year): self { $this->year = $year; return $this; } /** * @return Collection|Artist[] */ public function getArtists(): Collection { return $this->artists; } public function addArtist(Artist $artist): self { if (!$this->artists->contains($artist)) { $this->artists[] = $artist; } return $this; } public function removeArtist(Artist $artist): self { $this->artists->removeElement($artist); return $this; } public function getState(): ?string { return $this->state; } public function setState(string $state): self { $this->state = $state; return $this; }}