setNom($nom); if (null !== $symbole) { $this->setSymbole($symbole); } } /** * @param integer|null $id * @return Pays */ public function setId($id) { $this->id = (int) $id; return $this; } /** * @return integer|null */ public function getId() { return $this->id; } /** * @param string $nom * @return Pays */ public function setNom($nom) { if ('' === trim((string) $nom)) { throw new InvalidArgumentException('Le nom ne peut pas être vide.'); } $this->nom = $nom; return $this; } /** * @return string|null */ public function getNom() { return $this->nom; } /** * @param string $symbole * @return Pays */ public function setSymbole($symbole) { if ('' === trim((string) $symbole)) { throw new InvalidArgumentException('Le symbole ne peut pas être vide.'); } $this->symbole = $symbole; return $this; } /** * @return string|null */ public function getSymbole() { return $this->symbole; } /** * @return Pays */ public function addParticipant(Participant $participant) { foreach ($this->getParticipants() as $p) { if ($p === $participant) { return $this; } } $this->participants[] = $participant; if ($this !== $participant->getPays()) { $participant->setPays($this); } return $this; } /** * @param mixed[] $participants * @return Pays */ public function setParticipants(array $participants) { $this->participants = []; foreach ($participants as $participant) { $this->addParticipant($participant); } return $this; } public function getParticipants() { return $this->participants; } /** * @param Video $video * @return boolean Le pays est associé à la vidéo */ public function hasVideo(Video $video) { foreach ($this->getVideos() as $p) { if ($p === $video) { return true; } } return false; } /** * @return Pays */ public function addVideo(Video $video) { if ($this->hasVideo($video)) { return $this; } $this->videos[] = $video; $video->addPays($this); return $this; } /** * @param mixed[] $videos * @return Pays */ public function setVideos(array $videos) { $this->videos = []; foreach ($videos as $v) { $this->addVideo($v); } return $this; } /** * @return mixed[] $videos */ public function getVideos() { return $this->videos; } }