コード例 #1
0
 /**
  * @param Film $film
  * @return array
  */
 public function search(Film $film)
 {
     $query = $this->createQueryBuilder('a');
     $query->where('a.title LIKE :title')->setParameter('title', '%' . $film->getTitle() . '%')->orderBy('a.id', 'DESC');
     return $query->getQuery()->getResult();
 }
コード例 #2
0
ファイル: testclasses.php プロジェクト: fahim993/aidamvc
$year = 2015;
$film = new Film($title, $year, "john dontknow");
echo "New item created using constructor with : title = {$title} and year = {$year} <br />";
echo $film->toString() . "<br /><br />";
echo "Now setting a plot to:<br />";
$film->setPlot("A lot of stuff happens");
echo $film->getPlot() . "<br /><br />";
echo "Now changing the year to :<br />";
$film->setYear("2016");
echo $film->getYear() . "<br /><br />";
echo "Now changing the director to :<br />";
$film->setDirector("Fahim");
echo $film->getDirector() . "<br /><br />";
echo "Now changing the title to :<br />";
$film->setTitle("AIDA");
echo $film->getTitle() . "<br /><br />";
echo "Now the film is: " . $film->toString() . "<br />";
echo "<h4>FilmItem Class Test</h4>";
$newFilm = new Film("E.T. 2", 2020, "Steven Spielberg");
echo $newFilm->toString();
echo "<h4>Collection Class Test</h4>";
echo "<p>Create 3 line of films and add them to the collections</p>";
$filmCollection[] = new Film("First film", 2000, "Tarantino");
$filmCollection[] = new Film("Second film", 2005, "Robert Rodriguez");
$filmCollection[] = new Film("Third film", 2010, "Steven Speilberg");
foreach ($filmCollection as $filmSingle) {
    echo $filmSingle->toString() . "<br />";
}
echo "<br/><br/><p>Collection after removing 2nd line film</p>";
unset($filmCollection[1]);
$filmCollection = array_values($filmCollection);