src/Entity/Studio.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\StudioRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. #[ORM\Entity(repositoryClassStudioRepository::class)]
  10. class Studio
  11. {
  12.     #[Groups(['main'])]
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[Groups(['main'])]
  18.     #[ORM\Column(length255)]
  19.     private ?string $name null;
  20.     #[Groups(['main'])]
  21.     #[ORM\Column(typeTypes::TEXT)]
  22.     private ?string $description null;
  23.     #[ORM\OneToMany(mappedBy'studio'targetEntityVideo::class)]
  24.     #[ORM\OrderBy(['title' => 'ASC'])]
  25.     private Collection $videos;
  26.     public function __construct()
  27.     {
  28.         $this->videos = new ArrayCollection();
  29.     }
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getName(): ?string
  35.     {
  36.         return $this->name;
  37.     }
  38.     public function setName(string $name): self
  39.     {
  40.         $this->name $name;
  41.         return $this;
  42.     }
  43.     public function getDescription(): ?string
  44.     {
  45.         return $this->description;
  46.     }
  47.     public function setDescription(string $description): self
  48.     {
  49.         $this->description $description;
  50.         return $this;
  51.     }
  52.     /**
  53.      * @return Collection<int, Video>
  54.      */
  55.     public function getVideos(): Collection
  56.     {
  57.         return $this->videos;
  58.     }
  59.     public function addVideo(Video $video): self
  60.     {
  61.         if (!$this->videos->contains($video)) {
  62.             $this->videos->add($video);
  63.             $video->setStudio($this);
  64.         }
  65.         return $this;
  66.     }
  67.     public function removeVideo(Video $video): self
  68.     {
  69.         if ($this->videos->removeElement($video)) {
  70.             // set the owning side to null (unless already changed)
  71.             if ($video->getStudio() === $this) {
  72.                 $video->setStudio(null);
  73.             }
  74.         }
  75.         return $this;
  76.     }
  77. }