Esempio n. 1
0
 public function getGroup($id = NULL)
 {
     if ($id) {
         $stmt = $this->pdo->PDOInstance->prepare("SELECT * FROM group_product WHERE id= :id");
         $stmt->bindParam(':id', $id);
     } else {
         $stmt = $this->pdo->PDOInstance->prepare("SELECT * FROM group_product");
     }
     try {
         $stmt->execute();
     } catch (Exception $e) {
         echo "Problem at " . $e->getLine() . " from model Extraction :" . $e->getMessage();
     }
     $stmt = $stmt->fetchAll(PDO::FETCH_ASSOC);
     $result = array();
     foreach ($stmt as $group) {
         $group_ = new group_products();
         $group_->setId($group["id"]);
         $group_->setName($group["name"]);
         $group_->setType($group["type"]);
         array_push($result, $group_);
     }
     return $result;
 }