diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php b/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php index 3f45421e510ae90bdce42ef3416048b4e38fbf00..4c973e1f428e9aed052c5acb82b7b62e97b58b59 100644 --- a/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php +++ b/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php @@ -76,6 +76,8 @@ public function post($id, EntityInterface $entity) { } try { $entity->save(); + watchdog('rest', 'Created entity %type with ID %id.', array('%type' => $entity->entityType(), '%id' => $entity->id())); + $url = url(strtr($this->plugin_id, ':', '/') . '/' . $entity->id(), array('absolute' => TRUE)); // 201 Created responses have an empty body. return new ResourceResponse(NULL, 201, array('Location' => $url)); @@ -114,6 +116,8 @@ public function put($id, EntityInterface $entity) { $entity->{$info['entity_keys']['id']} = $id; try { $entity->save(); + watchdog('rest', 'Updated entity %type with ID %id.', array('%type' => $entity->entityType(), '%id' => $entity->id())); + // Update responses have an empty body. return new ResourceResponse(NULL, 204); } @@ -157,6 +161,8 @@ public function patch($id, EntityInterface $entity) { } try { $original_entity->save(); + watchdog('rest', 'Updated entity %type with ID %id.', array('%type' => $entity->entityType(), '%id' => $entity->id())); + // Update responses have an empty body. return new ResourceResponse(NULL, 204); } @@ -182,6 +188,8 @@ public function delete($id) { if ($entity) { try { $entity->delete(); + watchdog('rest', 'Deleted entity %type with ID %id.', array('%type' => $entity->entityType(), '%id' => $entity->id())); + // Delete responses have an empty body. return new ResourceResponse(NULL, 204); }