You are here

public function MyModuleBookResourceController::create in RESTful Web Services 7.2

Same name and namespace in other branches
  1. 7 restws.api.php \MyModuleBookResourceController::create()

Overrides RestWSResourceControllerInterface::create

See also

RestWSResourceControllerInterface::create()

File

./restws.api.php, line 211
This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.

Class

MyModuleBookResourceController
Example controller class for the mymodule_book resource.

Code

public function create(array $values) {
  try {
    $book = mymodule_book_save($values);
    return $book->id;
  } catch (Exception $e) {
    throw new RestWSException('Creation error', 406);
  }
}