Beispiel #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;
 }
Beispiel #2
0
 static function findAll($dbh, $sortKey, $fieldKey, $withSteps = false)
 {
     $stmt = $dbh->prepare("SELECT * FROM " . Recipe::$nameTable . " ORDER BY " . $fieldKey . " " . $sortKey);
     $stmt->execute();
     $result = array();
     while ($row = $stmt->fetch()) {
         $r = new Recipe();
         $r->copyFromRow($row);
         if ($withSteps) {
             $r->getRecipeSteps($dbh);
             $r->getRecipeDetails($dbh);
         }
         $result[] = $r;
     }
     return $result;
 }