178 lines
3.3 KiB
PHP
178 lines
3.3 KiB
PHP
<?php
|
|
|
|
class Participant extends Personne
|
|
{
|
|
/**
|
|
* @var string $image Image
|
|
*/
|
|
protected $image;
|
|
|
|
/**
|
|
* @var Pays $pays
|
|
*/
|
|
protected $pays;
|
|
|
|
/**
|
|
* @var mixed(] $videosRealisees Vidéos réalisées
|
|
*/
|
|
protected $videosRealisees = [];
|
|
|
|
/**
|
|
* @var mixed(] $videosJouees Vidéos jouées (acteur)
|
|
*/
|
|
protected $videosJouees = [];
|
|
|
|
/**
|
|
* @param string $image
|
|
* @return Participant
|
|
*/
|
|
public function setImage($image)
|
|
{
|
|
if ('' === trim((string) $image)) {
|
|
throw new InvalidArgumentException('L\'image ne peut pas être vide.');
|
|
}
|
|
|
|
$this->image = $image;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return string|null
|
|
*/
|
|
public function getImage()
|
|
{
|
|
return $this->image;
|
|
}
|
|
|
|
/**
|
|
* @param Pays $pays
|
|
*/
|
|
public function setPays(Pays $pays)
|
|
{
|
|
$this->pays = $pays;
|
|
|
|
$this->pays->addParticipant($this);
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Pays
|
|
*/
|
|
public function getPays()
|
|
{
|
|
return $this->pays;
|
|
}
|
|
|
|
/**
|
|
* @param Video $vidéo
|
|
* @return boolean La vidéo est associée à l'acteur
|
|
*/
|
|
public function hasVideoJouee(Video $video)
|
|
{
|
|
foreach ($this->getVideoJouees() as $p) {
|
|
if ($p === $video) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* @param Video $video
|
|
* @return Participant
|
|
*/
|
|
public function addVideoJouee(Video $video)
|
|
{
|
|
if ($this->hasVideoJouee($video)) {
|
|
return $this;
|
|
}
|
|
|
|
$this->videosJouees[] = $video;
|
|
|
|
$video->addActeur($this);
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @param mixed[] $videosJouees
|
|
* @return Participant
|
|
*/
|
|
public function setVideoJouees(array $videosJouees)
|
|
{
|
|
$this->videosJouees = [];
|
|
|
|
foreach ($videosJouees as $v) {
|
|
$this->addVideoJouee($v);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed[] $realisateurs
|
|
*/
|
|
public function getVideoJouees()
|
|
{
|
|
return $this->videosJouees;
|
|
}
|
|
|
|
/**
|
|
* @param Video $vidéo
|
|
* @return boolean La vidéo est associée au realisateur
|
|
*/
|
|
public function hasVideoRealisee(Video $video)
|
|
{
|
|
foreach ($this->getVideoRealisees() as $p) {
|
|
if ($p === $video) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* @param Video $video
|
|
* @return Participant
|
|
*/
|
|
public function addVideoRealisee(Video $video)
|
|
{
|
|
if ($this->hasVideoRealisee($video)) {
|
|
return $this;
|
|
}
|
|
|
|
$this->videosRealisees[] = $video;
|
|
|
|
$video->addRealisateur($this);
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @param mixed[] $videosRealisees
|
|
* @return Participant
|
|
*/
|
|
public function setVideoRealisees(array $videosRealisees)
|
|
{
|
|
$this->videosRealisees = [];
|
|
|
|
foreach ($videosRealisees as $v) {
|
|
$this->addVideoRealisee($v);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed[] $videosRealisees
|
|
*/
|
|
public function getVideoRealisees()
|
|
{
|
|
return $this->videosRealisees;
|
|
}
|
|
}
|