src/Entity/Video.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\VideoRepository;
  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(repositoryClassVideoRepository::class)]
  10. class Video
  11. {
  12.     const STATUS_CREATED 0;
  13.     const STATUS_ACTIVE 1;
  14.     const STATUS_PROCESSING 2;
  15.     const STATUS_INACTIVE 3;
  16.     const STATUS_LOCKED 4;
  17.     const STATUS_ERROR 5;
  18.     #[Groups(['main'])]
  19.     #[ORM\Id]
  20.     #[ORM\GeneratedValue]
  21.     #[ORM\Column]
  22.     private ?int $id null;
  23.     #[Groups(['main'])]
  24.     #[ORM\Column(typeTypes::SMALLINT)]
  25.     private int $status self::STATUS_CREATED;
  26.     #[Groups(['main'])]
  27.     #[ORM\Column(length255)]
  28.     private string $title '';
  29.     #[Groups(['main'])]
  30.     #[ORM\Column(typeTypes::TEXT)]
  31.     private string $description '';
  32.     #[Groups(['main'])]
  33.     #[ORM\Column(typeTypes::SMALLINT)]
  34.     private int $source 0;
  35.     #[Groups(['main'])]
  36.     #[ORM\Column(typeTypes::SMALLINT)]
  37.     private int $year 0;
  38.     #[Groups(['main'])]
  39.     #[ORM\Column(typeTypes::SMALLINT)]
  40.     private int $length 0;
  41.     #[ORM\ManyToMany(targetEntityTag::class, inversedBy'videos')]
  42.     #[ORM\OrderBy(['name' => 'ASC'])]
  43.     private Collection $tags;
  44.     #[ORM\OneToMany(mappedBy'video'targetEntityVideoImage::class)]
  45.     private Collection $images;
  46.     #[ORM\ManyToMany(targetEntityActor::class, inversedBy'videos')]
  47.     private Collection $actors;
  48.     #[Groups(['main'])]
  49.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  50.     private ?VideoImage $front_image null;
  51.     #[ORM\Column(length255)]
  52.     private string $filename '';
  53.     #[Groups(['main'])]
  54.     #[ORM\ManyToOne(inversedBy'videos')]
  55.     private ?Studio $studio null;
  56.     public function __construct()
  57.     {
  58.         $this->tags = new ArrayCollection();
  59.         $this->images = new ArrayCollection();
  60.         $this->actors = new ArrayCollection();
  61.     }
  62.     public function getId(): ?int
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function getStatus(): ?int
  67.     {
  68.         return $this->status;
  69.     }
  70.     public function setStatus(int $status): self
  71.     {
  72.         $this->status $status;
  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 getDescription(): ?string
  85.     {
  86.         return $this->description;
  87.     }
  88.     public function setDescription(string $description): self
  89.     {
  90.         $this->description $description;
  91.         return $this;
  92.     }
  93.     public function getSource(): ?int
  94.     {
  95.         return $this->source;
  96.     }
  97.     public function setSource(int $source): self
  98.     {
  99.         $this->source $source;
  100.         return $this;
  101.     }
  102.     public function getYear(): ?int
  103.     {
  104.         return $this->year;
  105.     }
  106.     public function setYear(int $year): self
  107.     {
  108.         $this->year $year;
  109.         return $this;
  110.     }
  111.     public function getLength(): ?int
  112.     {
  113.         return $this->length;
  114.     }
  115.     public function setLength(int $length): self
  116.     {
  117.         $this->length $length;
  118.         return $this;
  119.     }
  120.     /**
  121.      * @return Collection<int, tag>
  122.      */
  123.     public function getTags(): Collection
  124.     {
  125.         return $this->tags;
  126.     }
  127.     public function addTag(tag $tag): self
  128.     {
  129.         if (!$this->tags->contains($tag)) {
  130.             $this->tags->add($tag);
  131.         }
  132.         return $this;
  133.     }
  134.     public function removeTag(tag $tag): self
  135.     {
  136.         $this->tags->removeElement($tag);
  137.         return $this;
  138.     }
  139.     /**
  140.      * @return Collection<int, VideoImage>
  141.      */
  142.     public function getImages(): Collection
  143.     {
  144.         return $this->images;
  145.     }
  146.     public function addImage(VideoImage $image): self
  147.     {
  148.         if (!$this->images->contains($image)) {
  149.             $this->images->add($image);
  150.             $image->setVideo($this);
  151.         }
  152.         return $this;
  153.     }
  154.     public function removeImage(VideoImage $image): self
  155.     {
  156.         if ($this->images->removeElement($image)) {
  157.             // set the owning side to null (unless already changed)
  158.             if ($image->getVideo() === $this) {
  159.                 $image->setVideo(null);
  160.             }
  161.         }
  162.         return $this;
  163.     }
  164.     /**
  165.      * @return Collection<int, Actor>
  166.      */
  167.     public function getActors(): Collection
  168.     {
  169.         return $this->actors;
  170.     }
  171.     public function addActor(Actor $actor): self
  172.     {
  173.         if (!$this->actors->contains($actor)) {
  174.             $this->actors->add($actor);
  175.         }
  176.         return $this;
  177.     }
  178.     public function removeActor(Actor $actor): self
  179.     {
  180.         $this->actors->removeElement($actor);
  181.         return $this;
  182.     }
  183.     public function getFrontImage(): ?VideoImage
  184.     {
  185.         return $this->front_image;
  186.     }
  187.     public function setFrontImage(?VideoImage $front_image): self
  188.     {
  189.         $this->front_image $front_image;
  190.         return $this;
  191.     }
  192.     public function getFilename(): ?string
  193.     {
  194.         return $this->filename;
  195.     }
  196.     public function setFilename(string $filename): self
  197.     {
  198.         $this->filename $filename;
  199.         return $this;
  200.     }
  201.     public function getStudio(): ?Studio
  202.     {
  203.         return $this->studio;
  204.     }
  205.     public function setStudio(?Studio $studio): self
  206.     {
  207.         $this->studio $studio;
  208.         return $this;
  209.     }
  210. }