/** * New group * * @param Request $r */ public static function apiCreate(Request $r) { self::authenticateRequest($r); Validators::isValidAlias($r["alias"], "alias", true); Validators::isStringNonEmpty($r["name"], "name", true); Validators::isStringNonEmpty($r["description"], "description", false); try { $group = new Groups(array("owner_id" => $r["current_user_id"], "name" => $r["name"], "description" => $r["description"], "alias" => $r["alias"], "create_time" => gmdate('Y-m-d H:i:s', time()))); GroupsDAO::save($group); self::$log->info("Group " . $r["alias"] . " created."); } catch (Exception $e) { throw new InvalidDatabaseOperationException($e); } return array("status" => "ok"); }
/** * New group * * @param Request $r */ public static function apiCreate(Request $r) { self::authenticateRequest($r); Validators::isValidAlias($r['alias'], 'alias', true); Validators::isStringNonEmpty($r['name'], 'name', true); Validators::isStringNonEmpty($r['description'], 'description', false); try { $group = new Groups(array('owner_id' => $r['current_user_id'], 'name' => $r['name'], 'description' => $r['description'], 'alias' => $r['alias'], 'create_time' => gmdate('Y-m-d H:i:s', time()))); GroupsDAO::save($group); self::$log->info('Group ' . $r['alias'] . ' created.'); } catch (Exception $e) { throw new InvalidDatabaseOperationException($e); } return array('status' => 'ok'); }