src/Entity/Style.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\StyleRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=StyleRepository::class)
  9.  */
  10. class Style
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\ManyToMany(targetEntity=Vinyl::class, mappedBy="styles")
  24.      */
  25.     private $vinyls;
  26.     /**
  27.      * @ORM\ManyToMany(targetEntity=Cd::class, mappedBy="styles")
  28.      */
  29.     private $cds;
  30.     /**
  31.      * @ORM\Column(type="string", length=255)
  32.      */
  33.     private $slug;
  34.     public function __construct()
  35.     {
  36.         $this->vinyls = new ArrayCollection();
  37.         $this->cds = new ArrayCollection();
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getName(): ?string
  44.     {
  45.         return $this->name;
  46.     }
  47.     public function setName(string $name): self
  48.     {
  49.         $this->name $name;
  50.         return $this;
  51.     }
  52.     /**
  53.      * @return Collection|Vinyl[]
  54.      */
  55.     public function getVinyls(): Collection
  56.     {
  57.         return $this->vinyls;
  58.     }
  59.     public function addVinyl(Vinyl $vinyl): self
  60.     {
  61.         if (!$this->vinyls->contains($vinyl)) {
  62.             $this->vinyls[] = $vinyl;
  63.             $vinyl->addStyle($this);
  64.         }
  65.         return $this;
  66.     }
  67.     public function removeVinyl(Vinyl $vinyl): self
  68.     {
  69.         if ($this->vinyls->removeElement($vinyl)) {
  70.             $vinyl->removeStyle($this);
  71.         }
  72.         return $this;
  73.     }
  74.     /**
  75.      * @return Collection|Cd[]
  76.      */
  77.     public function getCds(): Collection
  78.     {
  79.         return $this->cds;
  80.     }
  81.     public function addCd(Cd $cd): self
  82.     {
  83.         if (!$this->cds->contains($cd)) {
  84.             $this->cds[] = $cd;
  85.             $cd->addStyle($this);
  86.         }
  87.         return $this;
  88.     }
  89.     public function removeCd(Cd $cd): self
  90.     {
  91.         if ($this->cds->removeElement($cd)) {
  92.             $cd->removeStyle($this);
  93.         }
  94.         return $this;
  95.     }
  96.     public function getSlug(): ?string
  97.     {
  98.         return $this->slug;
  99.     }
  100.     public function setSlug(string $slug): self
  101.     {
  102.         $this->slug $slug;
  103.         return $this;
  104.     }
  105.     public function __toString()
  106.     {
  107.         return $this->name;
  108.     }
  109. }