Ejemplo n.º 1
0
 public function getGroup($groupId)
 {
     try {
         $group = Group::getById($groupId);
         if (is_null($group)) {
             throw new \Exception("Group " . $groupId . " does not exist");
         }
         $this->getApp()->render(200, ['data' => $group->toArray()]);
     } catch (\Exception $e) {
         $this->getApp()->render(500, ['error' => $e->getMessage()]);
     }
 }
Ejemplo n.º 2
0
 private static function createFromDb($resource)
 {
     if (!is_null($resource)) {
         $group = new Group();
         $group->setGroupId($resource["group_id"]);
         $group->setGroupName($resource["name"]);
         $group->setGroupDescription($resource["description"]);
         $group->setCreatedDate($resource["created_date"]);
         return $group;
     }
     return null;
 }