As of #2831134: Remove configurable 'id_field': always use UUID, we no longer have global JSON API configuration, so we can remove it altogether. Which also means we can simplify the construction of ResourceConfig objects.

This is a blocker for #2829398: Clean up JsonApiResource: the annotation, plugin type, plugin manager, plugin implementations, the dynamic routes generator and the request handler.

CommentFileSizeAuthor
#2 2841048-2.patch9.67 KBWim Leers
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers created an issue. See original summary.

Wim Leers’s picture

Status: Active » Needs review
FileSize
9.67 KB

.

Wim Leers’s picture

  1. +++ b/src/Configuration/ResourceConfig.php
    @@ -17,13 +17,6 @@ use Drupal\Core\Entity\EntityTypeManagerInterface;
    -  protected $globalConfig;
    
    @@ -68,13 +61,6 @@ class ResourceConfig implements ResourceConfigInterface {
    -  public function getGlobalConfig() {
    -    return $this->globalConfig;
    -  }
    

    This is what's key.

  2. +++ b/src/Configuration/ResourceConfig.php
    @@ -148,13 +134,10 @@ class ResourceConfig implements ResourceConfigInterface {
    -  public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager) {
    -    $this->globalConfig = $config_factory->get('jsonapi.resource_info');
    +  public function __construct(EntityTypeManagerInterface $entity_type_manager) {
    

    This is what follows: ResourceConfig objects no longer need the config factory to be injected.

  3. +++ b/src/Configuration/ResourceManager.php
    @@ -23,13 +23,6 @@ class ResourceManager implements ResourceManagerInterface {
    -  protected $configFactory;
    
    @@ -37,13 +30,6 @@ class ResourceManager implements ResourceManagerInterface {
    -  protected $moduleHandler;
    
    @@ -57,16 +43,10 @@ class ResourceManager implements ResourceManagerInterface {
    -    $this->configFactory = $config_factory;
    -    $this->moduleHandler = $module_handler;
       }
    

    Turns out we also no longer need to inject the module handler service.

Wim Leers’s picture

e0ipso’s picture

Status: Needs review » Reviewed & tested by the community

Everything looks good.

Wim Leers’s picture

Also, this is a net reduction: 8 files changed, 6 insertions, 58 deletions :)

  • e0ipso committed 8cc9b41 on 8.x-1.x authored by Wim Leers
    fix(Maintainability) Remove the config factory dependency in...
e0ipso’s picture

Status: Reviewed & tested by the community » Fixed
Wim Leers’s picture

Status: Fixed » Closed (fixed)

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