src/Entity/Video.php line 16

Open in your IDE?
  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\ORM\Mapping as ORM;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10.  * @ORM\Entity(repositoryClass=VideoRepository::class)
  11.  * @ORM\Table(indexes={@ORM\Index(columns={"influencer_id"})})
  12.  */
  13. class Video
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\ManyToOne(targetEntity=Influencer::class, inversedBy="videos")
  23.      * @ORM\JoinColumn(nullable=false)
  24.      */
  25.     private $influencer;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="videos")
  28.      * @ORM\JoinColumn(nullable=false)
  29.      */
  30.     private $user;
  31.     /**
  32.      * @ORM\Column(type="string", length=255)
  33.      */
  34.     private $slug;
  35.     /**
  36.      * @ORM\Column(type="string", length=255)
  37.      */
  38.     private $embed;
  39.     /**
  40.      * @ORM\Column(type="boolean")
  41.      */
  42.     private $actif;
  43.     /**
  44.      * @ORM\Column(type="datetime_immutable")
  45.      */
  46.     private $created_at;
  47.     /**
  48.      * @ORM\Column(type="datetime")
  49.      */
  50.     private $updated_at;
  51.     /**
  52.      * @ORM\Column(type="text", nullable=true)
  53.      */
  54.     private $description;
  55.     /**
  56.      * @Assert\File(maxSize="2147483648")
  57.      */
  58.     private $video;
  59.     /**
  60.      * @ORM\Column(type="integer")
  61.      */
  62.     private $views;
  63.     /**
  64.      * @ORM\Column(type="boolean")
  65.      */
  66.     private $uploaded;
  67.     /**
  68.      * @ORM\Column(type="string", length=255)
  69.      */
  70.     private $filecode;
  71.     /**
  72.      * @ORM\OneToMany(targetEntity=Comment::class, mappedBy="video")
  73.      */
  74.     private $comments;
  75.     /**
  76.      * @ORM\OneToMany(targetEntity=PhotoLike::class, mappedBy="video")
  77.      */
  78.     private $photoLikes;
  79.     private $url;
  80.     /**
  81.      * @ORM\Column(type="string", length=255, nullable=true)
  82.      */
  83.     private $webp;
  84.     /**
  85.      * @ORM\Column(type="string", length=500, nullable=true)
  86.      */
  87.     private $previewUrl;
  88.     /**
  89.      * @ORM\Column(type="string", length=45, nullable=true)
  90.      */
  91.     private $ip;
  92.     public function __construct()
  93.     {
  94.         $this->setActif(0);
  95.         $this->setUploaded(0);
  96.         $this->setViews(0);
  97.         $this->setVideo(null);
  98.         $this->setEmbed(1);
  99.         $this->setSlug('1');
  100.         $this->created_at = new \DateTimeImmutable();
  101.         $this->updated_at = new \DateTime();
  102.         $this->comments = new ArrayCollection();
  103.         $this->photoLikes = new ArrayCollection();
  104.     }
  105.     public function getId(): ?int
  106.     {
  107.         return $this->id;
  108.     }
  109.     public function getInfluencer(): ?Influencer
  110.     {
  111.         return $this->influencer;
  112.     }
  113.     public function setInfluencer(?Influencer $influencer): self
  114.     {
  115.         $this->influencer $influencer;
  116.         return $this;
  117.     }
  118.     public function getUser(): ?User
  119.     {
  120.         return $this->user;
  121.     }
  122.     public function setUser(?User $user): self
  123.     {
  124.         $this->user $user;
  125.         return $this;
  126.     }
  127.     public function getSlug(): ?string
  128.     {
  129.         return $this->slug;
  130.     }
  131.     public function setSlug(string $slug): self
  132.     {
  133.         $this->slug $slug;
  134.         return $this;
  135.     }
  136.     public function getEmbed(): ?string
  137.     {
  138.         return $this->embed;
  139.     }
  140.     public function setEmbed(string $embed): self
  141.     {
  142.         $this->embed $embed;
  143.         return $this;
  144.     }
  145.     public function getActif(): ?bool
  146.     {
  147.         return $this->actif;
  148.     }
  149.     public function setActif(bool $actif): self
  150.     {
  151.         $this->actif $actif;
  152.         return $this;
  153.     }
  154.     public function getCreatedAt(): ?\DateTimeImmutable
  155.     {
  156.         return $this->created_at;
  157.     }
  158.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  159.     {
  160.         $this->created_at $created_at;
  161.         return $this;
  162.     }
  163.     public function getUpdatedAt(): ?\DateTimeInterface
  164.     {
  165.         return $this->updated_at;
  166.     }
  167.     public function setUpdatedAt(\DateTimeInterface $updated_at): self
  168.     {
  169.         $this->updated_at $updated_at;
  170.         return $this;
  171.     }
  172.     public function getDescription(): ?string
  173.     {
  174.         return $this->description;
  175.     }
  176.     public function setDescription(?string $description): self
  177.     {
  178.         $this->description $description;
  179.         return $this;
  180.     }
  181.     public function getVideo(): ?string
  182.     {
  183.         return $this->video;
  184.     }
  185.     public function setVideo(File $file null)
  186.     {
  187.         $this->video $file;
  188.         return $this;
  189.     }
  190.     public function getViews(): ?int
  191.     {
  192.         return $this->views;
  193.     }
  194.     public function setViews(int $views): self
  195.     {
  196.         $this->views $views;
  197.         return $this;
  198.     }
  199.     public function getUploaded(): ?bool
  200.     {
  201.         return $this->uploaded;
  202.     }
  203.     public function setUploaded(bool $uploaded): self
  204.     {
  205.         $this->uploaded $uploaded;
  206.         return $this;
  207.     }
  208.     public function getFilecode(): ?string
  209.     {
  210.         return $this->filecode;
  211.     }
  212.     public function setFilecode(string $filecode): self
  213.     {
  214.         $this->filecode $filecode;
  215.         return $this;
  216.     }
  217.     public function getUrl(): ?string
  218.     {
  219.         return $this->url;
  220.     }
  221.     public function setUrl(string $url): self
  222.     {
  223.         $this->url $url;
  224.         return $this;
  225.     }
  226.     /**
  227.      * @return Collection<int, PhotoLike>
  228.      */
  229.     public function getNbPhotoLikes(): int
  230.     {
  231.         return sizeof($this->getPhotoLikes());
  232.     }
  233.     /**
  234.      * @return Collection<int, Comment>
  235.      */
  236.     public function getComments(): Collection
  237.     {
  238.         return $this->comments;
  239.     }
  240.     public function getNbComments(): int
  241.     {
  242.         return sizeof($this->getComments());
  243.     }
  244.     public function addComment(Comment $comment): self
  245.     {
  246.         if (!$this->comments->contains($comment)) {
  247.             $this->comments[] = $comment;
  248.             $comment->setVideo($this);
  249.         }
  250.         return $this;
  251.     }
  252.     public function removeComment(Comment $comment): self
  253.     {
  254.         if ($this->comments->removeElement($comment)) {
  255.             // set the owning side to null (unless already changed)
  256.             if ($comment->getVideo() === $this) {
  257.                 $comment->setVideo(null);
  258.             }
  259.         }
  260.         return $this;
  261.     }
  262.     /**
  263.      * @return Collection<int, PhotoLike>
  264.      */
  265.     public function getPhotoLikes(): Collection
  266.     {
  267.         return $this->photoLikes;
  268.     }
  269.     public function addPhotoLike(PhotoLike $photoLike): self
  270.     {
  271.         if (!$this->photoLikes->contains($photoLike)) {
  272.             $this->photoLikes[] = $photoLike;
  273.             $photoLike->setVideo($this);
  274.         }
  275.         return $this;
  276.     }
  277.     public function removePhotoLike(PhotoLike $photoLike): self
  278.     {
  279.         if ($this->photoLikes->removeElement($photoLike)) {
  280.             // set the owning side to null (unless already changed)
  281.             if ($photoLike->getVideo() === $this) {
  282.                 $photoLike->setVideo(null);
  283.             }
  284.         }
  285.         return $this;
  286.     }
  287.     public function getWebp(): ?string
  288.     {
  289.         return $this->webp;
  290.     }
  291.     public function setWebp(?string $webp): self
  292.     {
  293.         $this->webp $webp;
  294.         return $this;
  295.     }
  296.     public function getPreviewUrl(): ?string
  297.     {
  298.         return $this->previewUrl;
  299.     }
  300.     public function setPreviewUrl(?string $previewUrl): self
  301.     {
  302.         $this->previewUrl $previewUrl;
  303.         return $this;
  304.     }
  305.     public function getIp(): ?string
  306.     {
  307.         return $this->ip;
  308.     }
  309.     public function setIp(?string $ip): self
  310.     {
  311.         $this->ip $ip;
  312.         return $this;
  313.     }
  314. }