The \Drupal\rest_example\Controller\RestExampleClientController class extends \Drupal\Core\Controller\ControllerBase, but the only method it uses from that class is config().

Instead of extending ControllerBase, RestExampleClientController should:

  • Implement \Drupal\Core\DependencyInjection\ContainerInjectionInterface
  • Use \Drupal\Core\Messenger\MessengerTrait
  • Use \Drupal\Core\StringTranslation\StringTranslationTrait
  • Define a property for the configuration factory service

RestExampleClientController actually accesses ControllerBase::$configFactory before it is initialized with the effect of accessing a method on NULL.
Changing the class as described here fixes that bug too.

Issue fork examples-3458249

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

apaderno created an issue. See original summary.

avpaderno’s picture

Title: Change RestExampleClientController not to extend ControllerBase » Do not use ControllerBase as parent class for RestExampleClientController
Assigned: avpaderno » Unassigned
Issue summary: View changes
Status: Active » Needs review

  • apaderno committed 63ddbacf on 4.0.x
    Issue #3458249: Do not use ControllerBase as parent class for...
avpaderno’s picture

Status: Needs review » Fixed
avpaderno’s picture

Issue summary: View changes
avpaderno’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

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