You are here

public function RestWSBaseFormat::createResource in RESTful Web Services 7.2

Same name and namespace in other branches
  1. 7 restws.formats.inc \RestWSBaseFormat::createResource()

Creates a new resource.

Overrides RestWSFormatInterface::createResource

2 methods override RestWSBaseFormat::createResource()
RestWSFormatRDF::createResource in ./restws.formats.inc
Creates a new resource.
RestWSFormatXML::createResource in ./restws.formats.inc
Creates a new resource.

File

./restws.formats.inc, line 121
RESTful web services module formats.

Class

RestWSBaseFormat
A base for all simple formats that are just serializing/unserializing an array of property values.

Code

public function createResource($resourceController, $data) {
  $values = $this
    ->unserialize($resourceController
    ->propertyInfo(), $data);
  $id = $resourceController
    ->create($values);
  $ref = $this
    ->getResourceReference($resourceController
    ->resource(), $id);
  $function = __FUNCTION__;
  drupal_alter('restws_response', $ref, $function, $this->formatName, $resourceController);
  return $this
    ->serialize($ref);
}