/** * 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; }
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; }