static function findAll($dbh)
 {
     $stmt = $dbh->prepare("select * from " . Ingredient::$tableName);
     $stmt->execute();
     $result = array();
     while ($row = $stmt->fetch()) {
         $p = new Ingredient();
         $p->copyFromRow($row);
         $result[] = $p;
     }
     return $result;
 }
 static function findAll($dbh, $withSteps = false)
 {
     $stmt = $dbh->prepare("select * from " . Ingredient::$tableName . " order by id");
     $stmt->execute();
     $result = array();
     while ($row = $stmt->fetch()) {
         $i = new Ingredient();
         $i->copyFromRow($row);
         $result[] = $i;
     }
     return $result;
 }
Example #3
0
 function sortIngredientASC($dbh)
 {
     $order = "name";
     $stmt = $dbh->prepare("select * from " . Ingredient::$tableName . " ORDER BY {$order}");
     $stmt->execute();
     $result = array();
     while ($row = $stmt->fetch()) {
         $p = new Ingredient();
         $p->copyFromRow($row);
         $result[] = $p;
     }
     return $result;
 }