Resolve #3451984 "Automated drupal 11"
Closes #3451984
Merge request reports
Activity
48 48 ################ 49 49 variables: 50 50 SKIP_ESLINT: '1' 51 OPT_IN_TEST_PREVIOUS_MAJOR: '1' changed this line in version 2 of the diff
Not if we are keeping support for Drupal 9. See the comment here: https://www.drupal.org/project/jsonapi_extras/issues/3451984#comment-15634121 The goal is to keep Drupal 9 support if possible.
added 1 commit
- 9509a5f5 - Minor changes with respect to drupal version support.
@bbrala can you please review this MR? Let me know if any changes required.
added 1 commit
- b2050ea8 - Update file JsonApiNormalizerDecoratorBase.php
@bbrala please check this MR and let me know any further changes needed?
added 1 commit
- 7ae6b652 - Added phpcs:ignore in the constructor argument to handle comma trailing.
@bbrala please check whether this can be merged?
44 * @param \Drupal\jsonapi\ResourceType\ResourceTypeRepositoryInterface $jsonApiResourceRepository 45 * Resource type repository. 46 * @param \Drupal\Component\DependencyInjection\ContainerInterface|null $container 47 * The dependency injection container. 48 */ 49 public function __construct(ConfigFactoryInterface $config_factory, RouteBuilder $router_builder, ResourceTypeRepositoryInterface $jsonApiResourceRepository, ContainerInterface $container = NULL) { 50 parent::__construct($config_factory); 51 $this->routerBuilder = $router_builder; 52 $this->jsonApiResourceRepository = $jsonApiResourceRepository; 53 if ($container === NULL) { 54 $container = \Drupal::getContainer(); 55 @trigger_error('Calling ' . __METHOD__ . ' without the $container argument is deprecated in jsonapi_extras:8.x-3.24 and will be required in jsonapi_extras:8.x-4.0. See https://www.drupal.org/node/3384627', E_USER_DEPRECATED); 56 } 57 $this->container = $container; 58 } 59 changed this line in version 19 of the diff
1 1 name: JSON:API Extras 2 2 type: module 3 3 description: Builds on top of JSON:API to deliver extra functionality. 4 core_version_requirement: '^9.2 || ^10' 4 core_version_requirement: ^10 || ^11 changed this line in version 20 of the diff
48 48 ################ 49 49 variables: 50 50 SKIP_ESLINT: '1' 51 OPT_IN_TEST_PREVIOUS_MINOR: '1' 52 OPT_IN_TEST_NEXT_MINOR: '1' 53 OPT_IN_TEST_NEXT_MAJOR: '1' 51 54 # Ignore logo.psd file from cspell check. 32 35 protected $container; 33 36 37 /** 38 * Constructs a \Drupal\system\ConfigFormBase object. 39 * 40 * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory 41 * The factory for configuration objects. 42 * @param \Drupal\Core\ProxyClass\Routing\RouteBuilder $router_builder 43 * The router builder to rebuild menus after saving config entity. 44 * @param \Drupal\jsonapi\ResourceType\ResourceTypeRepositoryInterface $jsonApiResourceRepository 45 * Resource type repository. 46 * @param \Drupal\Component\DependencyInjection\ContainerInterface|null $container 47 * The dependency injection container. 48 */ 49 public function __construct(ConfigFactoryInterface $config_factory, RouteBuilder $router_builder, ResourceTypeRepositoryInterface $jsonApiResourceRepository, ContainerInterface $container = NULL) { 50 parent::__construct($config_factory); @bbrala it is extending configFormBase class, hence typedConfigManager as an argument is required here.
If we add minimum support of D10.2 and above with inclusion of typedConfigManager (As it is deprecated in D10.2.x) see https://git.drupalcode.org/project/drupal/-/blob/10.2.x/core/lib/Drupal/Core/Form/ConfigFormBase.php?ref_type=heads#L49
We can achieve D10||D11 with below code
public static function create(ContainerInterface $container) { $instance = parent::create($container); $instance->routerBuilder = $container->get('router.builder'); $instance->jsonApiResourceRepository = $container->get('jsonapi.resource_type.repository'); $instance->container = $container; return $instance; }
But also need to remove the constructor which I had done in one my commits which is being reverted now. :)
Edited by Ankit PathakI'm still not 100% sure i want to Drop 9. Although it would make life easier. I want to wait for @japerry. I need to consider the other moving parts in the ecosystem also unfrotunately.
@bbrala Then only concern I have regarding the typehints of serializer, normalizer and denormalizer
You can make it BC with either method. I used the classic method, @ankitv18 uses the more modern method. With the classic method you pass the service through the constructor and parent. For D9/10 the extra parameter doesn't do anything so its BC
Added @ankitv18 's suggestion above, it is cleaner and maintains BC through D9.
added 1 commit
- 7532314e - Test to check support for Drupal 9 through 11.
added 1 commit
- 71a3ac10 - Rewrite the form constructor and create methods to be BC and cleaner.
added 1 commit
- 754ff5b2 - Cleanup extra use cases and make ConfigForm consistent with SettingsForm.