/** * Associate a Movie object to this object * through the moviesGenres cross reference table. * * @param Movie $movie The Moviesgenres object to relate * @return void */ public function addMovie($movie) { if ($this->collMovies === null) { $this->initMovies(); } if (!$this->collMovies->contains($movie)) { // only add it if the **same** object is not already associated $moviesgenres = new Moviesgenres(); $moviesgenres->setMovie($movie); $this->addMoviesgenres($moviesgenres); $this->collMovies[] = $movie; } }