2018-03-05 09:39:43 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Created by PhpStorm.
|
|
|
|
* User: lucas
|
|
|
|
* Date: 27/02/18
|
|
|
|
* Time: 16:19
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace api\module;
|
|
|
|
|
|
|
|
|
|
|
|
use database\core\Repo;
|
|
|
|
use database\repo\ue;
|
|
|
|
use error\core\Error;
|
|
|
|
use error\core\Err;
|
|
|
|
|
|
|
|
class ueController{
|
|
|
|
|
|
|
|
|
|
|
|
/* (1) Returns 1 or all UEs
|
|
|
|
*
|
|
|
|
* @code<String> [OPT] The UE code
|
|
|
|
*
|
|
|
|
* @return ues<array> The UE(s) data
|
|
|
|
*
|
|
|
|
---------------------------------------------------------*/
|
|
|
|
public static function get($args){
|
|
|
|
$code = null;
|
|
|
|
extract($args);
|
|
|
|
|
|
|
|
/* Get the ue repo */
|
|
|
|
/** @var ue $ue_repo */
|
|
|
|
$ue_repo = Repo::getRepo('ue');
|
|
|
|
|
|
|
|
|
|
|
|
/* (1) Get All ues or 1 by its code (if set) */
|
|
|
|
$fetched = $ue_repo->get($code);
|
|
|
|
|
|
|
|
/* (3) Return data */
|
|
|
|
return ['ues' => $fetched];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-11 17:13:41 +00:00
|
|
|
/* (3) Deletes an existing UE
|
|
|
|
*
|
|
|
|
* @code<String> The UE code
|
|
|
|
*
|
|
|
|
* @return deleted<bool> Whether it has been removed
|
|
|
|
*
|
|
|
|
---------------------------------------------------------*/
|
|
|
|
public static function delete($args){
|
|
|
|
$code = '';
|
|
|
|
extract($args);
|
|
|
|
|
|
|
|
/* Get the ue repo */
|
|
|
|
/** @var ue $ue_repo */
|
|
|
|
$ue_repo = Repo::getRepo('ue');
|
|
|
|
|
|
|
|
/* (1) Try to delete */
|
|
|
|
return ['deleted' => $ue_repo->delete($code)];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-05 09:39:43 +00:00
|
|
|
}
|