/** * Creates an movie object based on a DB row. * * @param array $row The DB row containing movie data. * @return \MicroCMS\Domain\movie */ protected function buildDomainObject($row) { $movie = new Movie(); $movie->setId($row['mov_id']); $movie->setTitle($row['mov_title']); $movie->setDescriptionCourte($row['mov_description_short']); return $movie; }
/** * Creates an Movie object based on a DB row. * * @param array $row The DB row containing Movie data. * @return \MyMovies\Domain\Movie */ private function buildMovie(array $row) { $movie = new Movie(); $movie->setId($row['mov_id']); $movie->setTitle($row['mov_title']); $movie->setDescriptionShort($row['mov_description_short']); $movie->setDescriptionLong($row['mov_description_long']); $movie->setDirector($row['mov_director']); $movie->setYear($row['mov_year']); $movie->setImage($row['mov_image']); $movie->setCatId($row['cat_id']); return $movie; }
/** * Creates an movie object based on a DB row. * * @param array $row The DB row containing movie data. * @return \MyMovies\Domain\Movie */ protected function buildDomainObject($row) { $movie = new Movie(); $movie->setMov_id($row['mod_id']); $movie->setMov_title($row['mov_title']); $movie->setMov_description_short($row['mov_description_short']); $movie->setMov_description_long($row['mov_description_long']); $movie->setMov_director($row['mov_director']); $movie->setMov_year($row['mov_year']); $movie->setMov_image($row['mov_image']); $movie->setCat_id($row['cat_id']); return $movie; }
/** * Creates an Movie object based on a DB row. * * @param array $row The DB row containing Movie data. * @return \MyMovies\Domain\Movie */ protected function buildDomainObject($row) { $mov = new Movie(); $mov->setMovId($row['mov_id']); $mov->setMovTitle($row['mov_title']); $mov->setMovDescriptionShort($row['mov_description_short']); $mov->setMovDescriptionLong($row['mov_description_long']); $mov->setMovDirector($row['mov_director']); $mov->setMovYear($row['mov_year']); $mov->setMovImage($row['mov_image']); $mov->setCatId($row['cat_id']); return $mov; }
/** * Saves a movie into the database. * * @param \MyMovies\Domain\Article $article The article to save */ public function save(Movie $movie) { $movieData = array('mov_title' => $movie->getTitle(), 'mov_description_long' => $movie->getDescriptionLong(), 'mov_description_short' => $movie->getDescriptionShort(), 'mov_director' => $movie->getDirector(), 'mov_year' => $movie->getYear(), 'mov_image' => $movie->getImage()); if ($movie->getId()) { // The article has already been saved : update it $this->getDb()->update('movie', $movieData, array('mov_id' => $movie->getId())); } else { // The article has never been saved : insert it $this->getDb()->insert('movie', $movieData); // Get the id of the newly created user and set it on the entity. $id = $this->getDb()->lastInsertId(); $movie->setId($id); } }
protected function saveMovieImage(Movie $movie) { $file = $movie->getImage(); if (is_null($file)) { $fileName = $this->noImagesAvailable; } else { $name = str_replace(' ', '', $movie->getTitle()); $name = preg_replace('/[^A-Za-z0-9\\-]/', '', $name); //$name = str_replace(array('.', ',', '?', '!', ':', '_', ' ', '.'), '',$movie->getTitle()); $fileName = $name . "_" . md5(uniqid()) . '.' . $file->guessExtension(); $brochuresDir = $this->pathImageMovies; $file->move($brochuresDir, $fileName); } $movie->setImage($fileName); }
/** * Creates an Movie object based on a DB row. * * @param array $row The DB row containing Article data. * @return \MyMovies-kvari\Domain\Movie */ protected function buildDomainObject($row) { $movie = new Movie(); $movie->setId($row['mov_id']); $movie->setTitle($row['mov_title']); $movie->setSDescription($row['mov_description_short']); $movie->setLDescription($row['mov_description_long']); $movie->setDirector($row['mov_director']); $movie->setYear($row['mov_year']); $movie->setImage($row['mov_image']); return $movie; }
protected function buildDomainObject($row) { $movie = new Movie(); $movie->setId($row['mov_id']); $movie->setTitle($row['mov_title']); $movie->setDescriptionShort($row['mov_description_short']); $movie->setDescriptionLong($row['mov_description_long']); $moviet->setDirector($row['mov_director']); $movie->setYear($row['mov_year']); $movie->setImage($row['mov_image']); if (array_key_exists('cat_id', $row)) { $categoryId = $row['cat_id']; $category = $this->categoryDAO->find($categoryId); $movie->setCategory($category); } return $movie; }