diff --git a/classes/class.Video.php b/classes/class.Video.php index c334ba7..5a70f86 100644 --- a/classes/class.Video.php +++ b/classes/class.Video.php @@ -232,7 +232,7 @@ class Video return $this; } - $video->addVideo($this); + $type->addVideo($this); $this->types[] = $type; @@ -287,7 +287,7 @@ class Video return $this; } - $video->addVideo($this); + $format->addVideo($this); $this->formats[] = $format; @@ -342,7 +342,7 @@ class Video return $this; } - $video->addVideo($this); + $categorie->addVideo($this); $this->categories[] = $categorie; @@ -397,7 +397,7 @@ class Video return $this; } - $video->addVideo($this); + $pays->addVideo($this); $this->payss[] = $pays; @@ -426,4 +426,114 @@ class Video { return $this->payss; } + + /** + * @param Participant $acteur + * @return boolean La vidéo est associée au acteur + */ + public function hasActeur(Participant $acteur) + { + foreach ($this->getActeurs() as $p) { + if ($p === $acteur) { + return true; + } + } + + return false; + } + + /** + * @param Participant $acteur + * @return Video + */ + public function addActeur(Participant $acteur) + { + if ($this->hasActeur($acteur)) { + return $this; + } + + $acteur->addVideoActeur($this); + + $this->acteurs[] = $acteur; + + return $this; + } + + /** + * @param mixed[] $acteurs + * @return Video + */ + public function setActeurs(array $acteurs) + { + $this->acteurs = []; + + foreach ($this->getActeurs() as $v) { + $this->addActeur($v); + } + + return $this; + } + + /** + * @return mixed[] $acteurs + */ + public function getActeurs() + { + return $this->acteurs; + } + + /** + * @param Participant $realisateur + * @return boolean La vidéo est associée au realisateur + */ + public function hasRealisateur(Participant $realisateur) + { + foreach ($this->getRealisateurs() as $p) { + if ($p === $realisateur) { + return true; + } + } + + return false; + } + + /** + * @param Participant $realisateur + * @return Video + */ + public function addRealisateur(Participant $realisateur) + { + if ($this->hasRealisateur($realisateur)) { + return $this; + } + + $realisateur->addVideoRealisateur($this); + + $this->realisateurs[] = $realisateur; + + return $this; + } + + /** + * @param mixed[] $realisateurs + * @return Video + */ + public function setRealisateurs(array $realisateurs) + { + $this->realisateurs = []; + + foreach ($this->getRealisateurs() as $v) { + $this->addRealisateur($v); + } + + return $this; + } + + /** + * @return mixed[] $realisateurs + */ + public function getRealisateurs() + { + return $this->realisateurs; + } }