When installed this module in the latest drupal 8 dev branch, it raised fatal error when I access the page admin/config/services/rest .

The error can be fixed by replacing drupal_container with Drupal::service which is fixed in the drupal core ticket #2001206: Replace drupal_container() with Drupal::service()

Comments

pflame’s picture

I found that drupal_container function is used in multiple files when I add, edit resources. The comment has full patch which will replace the drupal_container with \Drupal::service()

klausi’s picture

Status: Needs review » Needs work
+++ b/lib/Drupal/restui/Controller/RestUIController.php
@@ -209,7 +209,7 @@ class RestUIController implements ContainerInjectionInterface {
+    $plugin_manager = \Drupal::service('plugin.manager.rest');

do not use \Drupal in classes. All dependencies of a class should be passed into the constructor, if possible. ContainerInjectionInterface with public static function create(ContainerInterface $container) helps with that. Example: https://drupal.org/node/2060189

juampynr’s picture

Status: Needs work » Fixed

Committed @pflame's patch http://drupalcode.org/project/restui.git/commit/1a58a4d Thanks!

Also improved Dependency Injection in the module's classes as suggested by @klausi http://drupalcode.org/project/restui.git/commit/b5b176c.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.