From 1c408b7c4cfa7ba707111b249122ef12547e9e0e Mon Sep 17 00:00:00 2001 From: webchick <webchick@24967.no-reply.drupal.org> Date: Fri, 8 Feb 2013 18:25:33 -0800 Subject: [PATCH] Issue #1909170 by klausi, moshe weitzman: REST write operations should log a watchdog message. --- .../Drupal/rest/Plugin/rest/resource/EntityResource.php | 8 ++++++++ 1 file changed, 8 insertions(+) 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 3f45421e510a..4c973e1f428e 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); } -- GitLab