Example #1
0
 * Category procedures
 */
$server->register('createCategory', function ($project_id, $name) use($category) {
    $values = array('project_id' => $project_id, 'name' => $name);
    list($valid, ) = $category->validateCreation($values);
    return $valid && $category->create($values);
});
$server->register('getCategory', function ($category_id) use($category) {
    return $category->getById($category_id);
});
$server->register('getAllCategories', function ($project_id) use($category) {
    return $category->getAll($project_id);
});
$server->register('updateCategory', function ($id, $name) use($category) {
    $values = array('id' => $id, 'name' => $name);
    list($valid, ) = $category->validateModification($values);
    return $valid && $category->update($values);
});
$server->register('removeCategory', function ($category_id) use($category) {
    return $category->remove($category_id);
});
/**
 * Comments procedures
 */
$server->register('createComment', function (array $values) use($comment) {
    list($valid, ) = $comment->validateCreation($values);
    return $valid && $comment->create($values);
});
$server->register('getComment', function ($comment_id) use($comment) {
    return $comment->getById($comment_id);
});