diff --git a/core/modules/rest/src/Plugin/rest/resource/DBLogResource.php b/core/modules/dblog/src/Plugin/rest/resource/DBLogResource.php similarity index 70% rename from core/modules/rest/src/Plugin/rest/resource/DBLogResource.php rename to core/modules/dblog/src/Plugin/rest/resource/DBLogResource.php index 461222273917..14893bbd3b95 100644 --- a/core/modules/rest/src/Plugin/rest/resource/DBLogResource.php +++ b/core/modules/dblog/src/Plugin/rest/resource/DBLogResource.php @@ -5,11 +5,11 @@ * Definition of Drupal\rest\Plugin\rest\resource\DBLogResource. */ -namespace Drupal\rest\Plugin\rest\resource; +namespace Drupal\dblog\Plugin\rest\resource; use Drupal\rest\Plugin\ResourceBase; use Drupal\rest\ResourceResponse; - +use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** @@ -25,17 +25,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; */ class DBLogResource extends ResourceBase { - /** - * Overrides \Drupal\rest\Plugin\ResourceBase::routes(). - */ - public function routes() { - // Only expose routes if the dblog module is enabled. - if (\Drupal::moduleHandler()->moduleExists('dblog')) { - return parent::routes(); - } - return new RouteCollection(); - } - /** * Responds to GET requests. * @@ -53,7 +42,10 @@ class DBLogResource extends ResourceBase { if (!empty($record)) { return new ResourceResponse($record); } + + throw new NotFoundHttpException(t('Log entry with ID @id was not found', array('@id' => $id))); } - throw new NotFoundHttpException(t('Log entry with ID @id was not found', array('@id' => $id))); + + throw new HttpException(t('No log entry ID was provided')); } } diff --git a/core/modules/rest/src/Tests/DBLogTest.php b/core/modules/dblog/src/Tests/Rest/DbLogResourceTest.php similarity index 90% rename from core/modules/rest/src/Tests/DBLogTest.php rename to core/modules/dblog/src/Tests/Rest/DbLogResourceTest.php index ca3806e44fd4..f61ba72037ee 100644 --- a/core/modules/rest/src/Tests/DBLogTest.php +++ b/core/modules/dblog/src/Tests/Rest/DbLogResourceTest.php @@ -5,22 +5,22 @@ * Definition of Drupal\rest\test\DBLogTest. */ -namespace Drupal\rest\Tests; +namespace Drupal\dblog\Tests\Rest; use Drupal\Component\Serialization\Json; use Drupal\rest\Tests\RESTTestBase; /** - * Tests the Watchdog resource to retrieve log messages. + * Tests the Watchdog REST resource to retrieve log messages. */ -class DBLogTest extends RESTTestBase { +class DbLogResourceTest extends RESTTestBase { /** * Modules to enable. * * @var array */ - public static $modules = array('hal', 'rest', 'dblog'); + public static $modules = array('hal', 'dblog'); public static function getInfo() { return array(