[module.category] implemented GET
This commit is contained in:
parent
0a0135487f
commit
c6fc6631fb
|
@ -10,18 +10,30 @@ namespace api\module;
|
|||
|
||||
|
||||
use database\core\Repo;
|
||||
use database\repo\category;
|
||||
|
||||
class categoryController
|
||||
{
|
||||
class categoryController{
|
||||
|
||||
/* (1) Returns 1 or all categories
|
||||
*
|
||||
* @cat_id<int> [OPT] The category id
|
||||
*
|
||||
* @return categories<array> The categorie(s) data
|
||||
*
|
||||
---------------------------------------------------------*/
|
||||
public function get($args){
|
||||
$idCat = 0;
|
||||
$cat_id = null;
|
||||
extract($args);
|
||||
|
||||
/** @var \database\repo\category $repo */
|
||||
$repo = Repo::getRepo("category");
|
||||
/** @var category $cat_repo */
|
||||
$cat_repo = Repo::getRepo('category');
|
||||
|
||||
/* (1) Get All categories or 1 by its id (if set) */
|
||||
$fetched = $cat_repo->get($cat_id);
|
||||
|
||||
/* (2) Return data */
|
||||
return ['categories' => $fetched];
|
||||
|
||||
return ["data" => $repo->getStats($idCat)];
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue