|
@@ -3,6 +3,7 @@
|
|
|
namespace App\Entity;
|
|
|
|
|
|
use App\Repository\FilmRepository;
|
|
|
+use Doctrine\Common\Collections\ArrayCollection;
|
|
|
use Doctrine\Common\Collections\Collection;
|
|
|
use Doctrine\DBAL\Types\DateImmutableType;
|
|
|
use Doctrine\DBAL\Types\Types;
|
|
@@ -84,6 +85,9 @@ class Film
|
|
|
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
|
|
|
private ?\DateTimeImmutable $dateSortie = null;
|
|
|
|
|
|
+ #[ORM\OneToMany(mappedBy: 'film', targetEntity: MediaVideo::class, orphanRemoval: true)]
|
|
|
+ private Collection $mediaVideos;
|
|
|
+
|
|
|
public function __construct()
|
|
|
{
|
|
|
$this->realisateurs = new \Doctrine\Common\Collections\ArrayCollection();
|
|
@@ -92,6 +96,7 @@ class Film
|
|
|
$this->genres = new \Doctrine\Common\Collections\ArrayCollection();
|
|
|
$this->commentaires = new \Doctrine\Common\Collections\ArrayCollection();
|
|
|
$this->setDateSubmited(new \DateTime());
|
|
|
+ $this->mediaVideos = new ArrayCollection();
|
|
|
}
|
|
|
|
|
|
public function getAuthered(): ?User
|
|
@@ -322,5 +327,35 @@ class Film
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @return Collection<int, MediaVideo>
|
|
|
+ */
|
|
|
+ public function getMediaVideos(): Collection
|
|
|
+ {
|
|
|
+ return $this->mediaVideos;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function addMediaVideo(MediaVideo $mediaVideo): self
|
|
|
+ {
|
|
|
+ if (!$this->mediaVideos->contains($mediaVideo)) {
|
|
|
+ $this->mediaVideos->add($mediaVideo);
|
|
|
+ $mediaVideo->setFilm($this);
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function removeMediaVideo(MediaVideo $mediaVideo): self
|
|
|
+ {
|
|
|
+ if ($this->mediaVideos->removeElement($mediaVideo)) {
|
|
|
+ // set the owning side to null (unless already changed)
|
|
|
+ if ($mediaVideo->getFilm() === $this) {
|
|
|
+ $mediaVideo->setFilm(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|