src/Entity/Track.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TrackRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=TrackRepository::class)
  9.  */
  10. class Track
  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 $filename;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=Vinyl::class, inversedBy="tracks")
  24.      * @ORM\JoinColumn(nullable=false)
  25.      */
  26.     private $vinyl;
  27.     /**
  28.      * @ORM\Column(type="string", length=2)
  29.      */
  30.     private $piste;
  31.     /**
  32.      * @ORM\Column(type="string", length=255)
  33.      */
  34.     private $title;
  35.     /**
  36.      * @ORM\ManyToMany(targetEntity=Artist::class, inversedBy="tracks")
  37.      * @ORM\OrderBy({"name" = "ASC"})
  38.      */
  39.     private $artists;
  40.     public function __construct()
  41.     {
  42.         $this->artists = new ArrayCollection();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getFilename(): ?string
  49.     {
  50.         return $this->filename;
  51.     }
  52.     public function setFilename(string $filename): self
  53.     {
  54.         $this->filename $filename;
  55.         return $this;
  56.     }
  57.     public function getVinyl(): ?Vinyl
  58.     {
  59.         return $this->vinyl;
  60.     }
  61.     public function setVinyl(?Vinyl $vinyl): self
  62.     {
  63.         $this->vinyl $vinyl;
  64.         return $this;
  65.     }
  66.     public function getPiste(): ?string
  67.     {
  68.         return $this->piste;
  69.     }
  70.     public function setPiste(string $piste): self
  71.     {
  72.         $this->piste $piste;
  73.         return $this;
  74.     }
  75.     public function getTitle(): ?string
  76.     {
  77.         return $this->title;
  78.     }
  79.     public function setTitle(string $title): self
  80.     {
  81.         $this->title $title;
  82.         return $this;
  83.     }
  84.     public function __toString()
  85.     {
  86.         return $this->title;
  87.     }
  88.     /**
  89.      * @return Collection|Artist[]
  90.      */
  91.     public function getArtists(): Collection
  92.     {
  93.         return $this->artists;
  94.     }
  95.     public function addArtist(Artist $artist): self
  96.     {
  97.         if (!$this->artists->contains($artist)) {
  98.             $this->artists[] = $artist;
  99.         }
  100.         return $this;
  101.     }
  102.     public function removeArtist(Artist $artist): self
  103.     {
  104.         $this->artists->removeElement($artist);
  105.         return $this;
  106.     }
  107. }