You are here

public function ServicesEntityResourceController::update in Services Entity API 7.2

Implements ServicesResourceControllerInterface::update().

Overrides ServicesResourceControllerInterface::update

1 method overrides ServicesEntityResourceController::update()
ServicesEntityResourceControllerClean::update in plugins/services_entity_resource_clean.inc
Implements ServicesResourceControllerInterface::update().

File

plugins/services_entity_resource.inc, line 90

Class

ServicesEntityResourceController
Generic controller for entity-bases resources.

Code

public function update($entity_type, $entity_id, array $values) {
  $this
    ->checkTextFormatAccess($values);
  $wrapper = entity_metadata_wrapper($entity_type, (object) $values);
  if ($entity_id == $wrapper
    ->getIdentifier()) {
    $wrapper
      ->save();
    return $wrapper
      ->value();
  }
  else {
    services_error('Invalid Entity Identifier. You can only update the entity referenced in the URL.', 406);
  }
}