src/Entity/Cd.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Product;
  4. use App\Repository\CdRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. /**
  9.  * @ORM\Entity(repositoryClass=CdRepository::class)
  10.  */
  11. class Cd extends Product
  12. {
  13.     /**
  14.      * @ORM\ManyToOne(targetEntity=Label::class, inversedBy="cds")
  15.      * @ORM\JoinColumn(nullable=false)
  16.      */
  17.     private $label;
  18.     /**
  19.      * @ORM\ManyToMany(targetEntity=Style::class, inversedBy="cds")
  20.      */
  21.     private $styles;
  22.     /**
  23.      * @ORM\Column(type="smallint")
  24.      */
  25.     private $year;
  26.     /**
  27.      * @ORM\ManyToMany(targetEntity=Artist::class, inversedBy="cds")
  28.      */
  29.     private $artists;
  30.     /**
  31.      * @ORM\Column(type="string", length=255)
  32.      */
  33.     private $state;
  34.     public function __construct()
  35.     {
  36.         $this->styles = new ArrayCollection();
  37.         $this->artists = new ArrayCollection();
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getLabel(): ?Label
  44.     {
  45.         return $this->label;
  46.     }
  47.     public function setLabel(?Label $label): self
  48.     {
  49.         $this->label $label;
  50.         return $this;
  51.     }
  52.     /**
  53.      * @return Collection|Style[]
  54.      */
  55.     public function getStyles(): Collection
  56.     {
  57.         return $this->styles;
  58.     }
  59.     public function addStyle(Style $style): self
  60.     {
  61.         if (!$this->styles->contains($style)) {
  62.             $this->styles[] = $style;
  63.         }
  64.         return $this;
  65.     }
  66.     public function removeStyle(Style $style): self
  67.     {
  68.         $this->styles->removeElement($style);
  69.         return $this;
  70.     }
  71.     public function getYear(): ?int
  72.     {
  73.         return $this->year;
  74.     }
  75.     public function setYear(int $year): self
  76.     {
  77.         $this->year $year;
  78.         return $this;
  79.     }
  80.     /**
  81.      * @return Collection|Artist[]
  82.      */
  83.     public function getArtists(): Collection
  84.     {
  85.         return $this->artists;
  86.     }
  87.     public function addArtist(Artist $artist): self
  88.     {
  89.         if (!$this->artists->contains($artist)) {
  90.             $this->artists[] = $artist;
  91.         }
  92.         return $this;
  93.     }
  94.     public function removeArtist(Artist $artist): self
  95.     {
  96.         $this->artists->removeElement($artist);
  97.         return $this;
  98.     }
  99.     public function getState(): ?string
  100.     {
  101.         return $this->state;
  102.     }
  103.     public function setState(string $state): self
  104.     {
  105.         $this->state $state;
  106.         return $this;
  107.     }
  108. }