public function RestWSBaseFormat::getResourceReference in RESTful Web Services 7.2
Same name and namespace in other branches
- 7 restws.formats.inc \RestWSBaseFormat::getResourceReference()
3 calls to RestWSBaseFormat::getResourceReference()
- RestWSBaseFormat::createResource in ./
restws.formats.inc - Creates a new resource.
- RestWSBaseFormat::getData in ./
restws.formats.inc - Gets a simple PHP array using URI references for some wrapped data.
- RestWSBaseFormat::queryResource in ./
restws.formats.inc - Implements RestWSFormatInterface::queryResource().
File
- ./
restws.formats.inc, line 230 - 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 getResourceReference($resource, $id) {
$return = array(
'uri' => restws_resource_uri($resource, $id),
'id' => $id,
'resource' => $resource,
);
if (module_exists('uuid') && ($info = entity_get_info($resource))) {
// Check whether the entity type integrates with UUID module.
if ($info['base table'] && in_array('uuid', $info['schema_fields_sql']['base table'])) {
$ids = entity_get_uuid_by_id($resource, array(
$id,
));
if ($id = reset($ids)) {
$return['uuid'] = $id;
}
}
}
return $return;
}