|
@@ -3,8 +3,8 @@
|
|
namespace App\Entity;
|
|
namespace App\Entity;
|
|
|
|
|
|
use App\Repository\FilmRepository;
|
|
use App\Repository\FilmRepository;
|
|
|
|
+use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
-use Doctrine\DBAL\Types\DateImmutableType;
|
|
|
|
use Doctrine\DBAL\Types\Types;
|
|
use Doctrine\DBAL\Types\Types;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
@@ -44,11 +44,13 @@ class Film
|
|
|
|
|
|
private ?int $nbComs = null;
|
|
private ?int $nbComs = null;
|
|
|
|
|
|
|
|
+ /*
|
|
#[Assert\Valid()]
|
|
#[Assert\Valid()]
|
|
#[ORM\OneToOne(targetEntity: MediaVideo::class, cascade: ["persist","remove"])]
|
|
#[ORM\OneToOne(targetEntity: MediaVideo::class, cascade: ["persist","remove"])]
|
|
#[ORM\JoinColumn(nullable: true)]
|
|
#[ORM\JoinColumn(nullable: true)]
|
|
|
|
|
|
private ?MediaVideo $mediaVideo = null;
|
|
private ?MediaVideo $mediaVideo = null;
|
|
|
|
+ */
|
|
|
|
|
|
#[ORM\ManyToMany(targetEntity: Realisateur::class, inversedBy: "films", cascade: ["persist"])]
|
|
#[ORM\ManyToMany(targetEntity: Realisateur::class, inversedBy: "films", cascade: ["persist"])]
|
|
|
|
|
|
@@ -84,6 +86,9 @@ class Film
|
|
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
|
|
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
|
|
private ?\DateTimeImmutable $dateSortie = null;
|
|
private ?\DateTimeImmutable $dateSortie = null;
|
|
|
|
|
|
|
|
+ #[ORM\OneToMany(mappedBy: 'film', targetEntity: MediaVideo::class, orphanRemoval: true, cascade: ['persist'])]
|
|
|
|
+ private ?Collection $mediaVideos = null;
|
|
|
|
+
|
|
public function __construct()
|
|
public function __construct()
|
|
{
|
|
{
|
|
$this->realisateurs = new \Doctrine\Common\Collections\ArrayCollection();
|
|
$this->realisateurs = new \Doctrine\Common\Collections\ArrayCollection();
|
|
@@ -92,6 +97,7 @@ class Film
|
|
$this->genres = new \Doctrine\Common\Collections\ArrayCollection();
|
|
$this->genres = new \Doctrine\Common\Collections\ArrayCollection();
|
|
$this->commentaires = new \Doctrine\Common\Collections\ArrayCollection();
|
|
$this->commentaires = new \Doctrine\Common\Collections\ArrayCollection();
|
|
$this->setDateSubmited(new \DateTime());
|
|
$this->setDateSubmited(new \DateTime());
|
|
|
|
+ $this->mediaVideos = new ArrayCollection();
|
|
}
|
|
}
|
|
|
|
|
|
public function getAuthered(): ?User
|
|
public function getAuthered(): ?User
|
|
@@ -310,7 +316,7 @@ class Film
|
|
return $this;
|
|
return $this;
|
|
}
|
|
}
|
|
|
|
|
|
- public function getMediaVideo(): ?MediaVideo
|
|
|
|
|
|
+ /*public function getMediaVideo(): ?MediaVideo
|
|
{
|
|
{
|
|
return $this->mediaVideo;
|
|
return $this->mediaVideo;
|
|
}
|
|
}
|
|
@@ -319,6 +325,36 @@ class Film
|
|
{
|
|
{
|
|
$this->mediaVideo = $mediaVideo;
|
|
$this->mediaVideo = $mediaVideo;
|
|
|
|
|
|
|
|
+ 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;
|
|
return $this;
|
|
}
|
|
}
|
|
|
|
|