Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Thalles created an issue. See original summary.

thalles’s picture

Hi, Congratulations on the module!
Here is the patch that injects dependencies.

thalles’s picture

Status: Needs work » Needs review
amietpatial’s picture

Status: Needs review » Needs work
FileSize
124.41 KB

@Thalles patch doesn't apply

thalles’s picture

Status: Needs work » Needs review

Please download the last version of module!

amietpatial’s picture

Status: Needs review » Reviewed & tested by the community

working fine

thalles’s picture

Assigned: thalles » Unassigned
Berdir’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/src/Form/PathautoSettingsForm.php
    @@ -34,14 +37,38 @@ class PathautoSettingsForm extends ConfigFormBase {
    +
    +  /**
    +   * Object moduleHandle.
    +   *
    +   * @var Drupal\Core\Extension\ModuleHandler
    +   */
    +  protected $moduleHandler;
    +
    

    Should say something like "The module handler" and so on.

  2. +++ b/src/Form/PathautoSettingsForm.php
    @@ -34,14 +37,38 @@ class PathautoSettingsForm extends ConfigFormBase {
       /**
        * {@inheritdoc}
        */
    -  public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $entity_field_manager, AliasTypeManager $alias_type_manager) {
    

    docblock needs to cover all arguments.

  3. +++ b/src/Form/PathautoSettingsForm.php
    @@ -52,7 +79,10 @@ class PathautoSettingsForm extends ConfigFormBase {
    +      $container->get('entity.query'),
    

    the entity query service is deprecated, this should use entityTypeManager->getStorage('x')->getQuery()

  4. +++ b/src/Form/PathautoSettingsForm.php
    @@ -127,10 +157,10 @@ class PathautoSettingsForm extends ConfigFormBase {
     
    -    $max_length = \Drupal::service('pathauto.alias_storage_helper')->getAliasSchemaMaxlength();
    +    $max_length = $this->serviceContainer->get('pathauto.alias_storage_helper')->getAliasSchemaMaxlength();
     
    

    this doesn't make sense, it should inject the actual service instead.

thalles’s picture

thalles’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
thalles’s picture

Status: Needs review » Needs work

The last submitted patch, 12: pathauto-drupal_dependency_injection_on_file_PathautoSettingsForm-3011482-12-D8.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

thalles’s picture

Follow the patch!

idebr’s picture

Attached patch implements the following changes:

  1. #8.1 Standardised the property descriptions based on similar occurrences in Drupal Core.
  2. #8.2 Updated the__construct() docblock.
  3. #8.3 / #8.4 have been fixed in #14
  4. Removed additional newlines that were introduced in this issue.
  5. Reordered use statements alphabetically for better readability.

  • Berdir committed 89a8aeb on 8.x-1.x authored by idebr
    Issue #3011482 by thalles, idebr, amietpatial: Drupal dependency...
Berdir’s picture

Status: Needs review » Fixed

Thanks.

Status: Fixed » Closed (fixed)

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