parent
4870dc04b2
commit
9eeaabc6fe
364 changed files with 51722 additions and 987 deletions
|
|
@ -10,6 +10,7 @@
|
|||
namespace PHPCI\Store;
|
||||
|
||||
use b8\Database;
|
||||
use PHPCI\Model\Project;
|
||||
use PHPCI\Store\Base\ProjectStoreBase;
|
||||
|
||||
/**
|
||||
|
|
@ -39,4 +40,26 @@ class ProjectStore extends ProjectStoreBase
|
|||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
$query = 'SELECT * FROM `project` ORDER BY `title` ASC';
|
||||
$stmt = Database::getConnection('read')->prepare($query);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
$res = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
$map = function ($item) {
|
||||
return new Project($item);
|
||||
};
|
||||
$rtn = array_map($map, $res);
|
||||
|
||||
$count = count($rtn);
|
||||
|
||||
|
||||
return array('items' => $rtn, 'count' => $count);
|
||||
} else {
|
||||
return array('items' => array(), 'count' => 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue