Exemplo n.º 1
0
 static function findAll($dbh, $withSteps = false)
 {
     $stmt = $dbh->prepare("select * from " . Recipe::$nameTable);
     $stmt->execute();
     $result = array();
     while ($row = $stmt->fetch()) {
         $r = new Recipe();
         $r->copyFromRow($row);
         $r->getRecipeSteps($dbh);
         $r->getRecipeDetails($dbh);
         $result[] = $r;
     }
     return $result;
 }
Exemplo n.º 2
0
 static function findByKeyword($dbh, $searchOne, $withSteps = false)
 {
     $stmt = $dbh->prepare("SELECT * FROM " . Recipe::$nameTable . " WHERE Name LIKE '%" . $searchOne . "%' AND Description LIKE '%" . $searchOne . "%'");
     $stmt->execute();
     $newResult = array();
     while ($row = $stmt->fetch()) {
         $r = new Recipe();
         $r->copyFromRow($row);
         if ($withSteps) {
             $r->getRecipeSteps($dbh);
         }
         $newResult[] = $r;
     }
     return $newResult;
 }