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