Beste PHP'ers,
Ik programmeer al aardig lang in OOP (in ZendStudio) maar zit nu met een vaag probleem waar ik niet uit kom, ik zie waarschijnlijk iets over het hoofd, maar ik zie niet waar.
Ik krijg soms een bericht over unfinished class declaration, maar dit ziet er in mijn ogen allemaal goed uit.
<?php
/**
* @package Nforce Webshop categories
* @author Jurgen Meijer <[email protected]>
* @license Nforce Entertainment
* @link www.nforce.nl
* @copyright 2010
*/
class CategoryControllerException extends Exception{}
class CategoryController{
public $database='';
$instances = array();
public function __construct(){
$this->database = DB::getInstance('PDO');
return $this->getAllCategories();
}
private function getAllCategories(){
$stmt = $this->database->prepare('SELECT categoryid, name, parentid, description FROM category;');
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($result AS $category){
$this->instances[] = new Category($category);
}
}
}
?>
2.853 views