Problem/Motivation

Steps to reproduce

Proposed resolution

Here is the patch. To fix issue: non-existent service "entity.manager". As entity manager service is split into different services. Reference: https://www.drupal.org/node/2549139

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork hashtags-3270906

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

vshlbndr created an issue. See original summary.

vshlbndr’s picture

Status: Active » Needs review
StatusFileSize
new1.53 KB

Here is the patch to resolve the issue.

guptahemant’s picture

Issue summary: View changes
ruturaj chaubey’s picture

  1. +++ b/hashtags.install
    @@ -28,7 +28,7 @@ function hashtags_uninstall() {
    +        $bundles = \Drupal::service('entity_type.bundle.info')->getBundleInfo($entity_type);
    
    +++ b/src/Form/ManagerForm.php
    +++ b/src/Form/ManagerForm.php
    @@ -48,7 +48,8 @@ class ManagerForm extends FormBase {
    

    Can you use dependency injection instead of using the services via the Drupal global class.

  2. +++ b/src/Form/ManagerForm.php
    @@ -48,7 +48,8 @@ class ManagerForm extends FormBase {
    +            $bundles = $bundle_info->getBundleInfo($entity_type);
    

    Can you use dependency injection instead of using the services via the Drupal global class.

ruturaj chaubey’s picture

Status: Needs review » Needs work
Johnny Santos’s picture

Assigned: Unassigned » Johnny Santos

I'm going to work as demanded on comment #4

Johnny Santos’s picture

Assigned: Johnny Santos » Unassigned
Status: Needs work » Needs review
StatusFileSize
new2.26 KB
new1.79 KB

Just finished what is demanded on one of the files, but I noticed that "hashtags.install" is not possible to make a dependency injection since its a procedural file(it does not contains classes).

vighneshh’s picture

Assigned: Unassigned » vighneshh

I will review This..

vighneshh’s picture

Assigned: vighneshh » Unassigned
Issue summary: View changes
Status: Needs review » Needs work
StatusFileSize
new47.51 KB

I Tried applying this patch 3270906-7.patch And the patch failed returning this error meesage.

vighnesh@vighnesh:/var/www/html/alldemo/web/modules/contrib/hashtags$ git apply /home/vighnesh/Downloads/patch/3270906-7.patch
/home/vighnesh/Downloads/patch/3270906-7.patch:35: trailing whitespace.
            $container->get('entity_type.bundle.info') 
error: patch failed: src/Form/ManagerForm.php:48
error: src/Form/ManagerForm.php: patch does not apply

this patch needs work.

ruturaj chaubey’s picture

Assigned: Unassigned » ruturaj chaubey
ruturaj chaubey’s picture

Assigned: ruturaj chaubey » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.58 KB

Added the necessary changes in this patch.

victoria-marina’s picture

Assigned: Unassigned » victoria-marina

I'll review this.

victoria-marina’s picture

Assigned: victoria-marina » Unassigned
Status: Needs review » Reviewed & tested by the community

The #11 successfully adds the dependency injection into the file. Looks good!

vighneshh’s picture

Assigned: Unassigned » vighneshh
Status: Reviewed & tested by the community » Active
$ phpcs --standard=DrupalPractice /var/www/html/alldemo/web/modules/contrib/hashtags/src/Form/ManagerForm.php

FILE: ...var/www/html/alldemo/web/modules/contrib/hashtags/src/Form/ManagerForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------
  24 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
  51 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
  93 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
 108 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
 117 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
 119 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
--------------------------------------------------------------------------------

Still seeing this coding standard issue when run phpcs --standard=DrupalPractice /var/www/html/alldemo/web/modules/contrib/hashtags/src/Form/ManagerForm.php

vighneshh’s picture

Assigned: vighneshh » Unassigned
Status: Active » Needs review
StatusFileSize
new4.94 KB

Adding a patch for the necessary changes in issue mention at #14.

libbna’s picture

I will review this.

libbna’s picture

StatusFileSize
new44.37 KB

There are no errors related to Dependency Injection but found these extra errors.

libbna’s picture

Status: Needs review » Needs work
victoria-marina’s picture

Assigned: Unassigned » victoria-marina

Working on this.

victoria-marina’s picture

Assigned: victoria-marina » Unassigned
Status: Needs work » Needs review
StatusFileSize
new68.21 KB
new68.64 KB

I made a patch to fix the warnings below:


FILE: .../contrib/hashtags/hashtags.info.yml
-----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------
 1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
 8 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
 9 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
-----------------------------------------------------------------------------------------------------------


FILE: .../contrib/hashtags/hashtags.module
---------------------------------------------------------------------------------------------------------------------
FOUND 60 ERRORS AND 1 WARNING AFFECTING 41 LINES
---------------------------------------------------------------------------------------------------------------------
   3 | ERROR   | Missing short description in doc comment
 171 | ERROR   | Missing parameter comment
 171 | ERROR   | Missing parameter type
 173 | ERROR   | Description for the @return value is missing
 196 | ERROR   | Description for the @return value is missing
 211 | ERROR   | Missing parameter comment
 211 | ERROR   | Missing parameter type
 212 | ERROR   | Missing parameter comment
 212 | ERROR   | Missing parameter type
 213 | ERROR   | Missing parameter comment
 213 | ERROR   | Missing parameter type
 215 | ERROR   | Description for the @return value is missing
 225 | ERROR   | Missing parameter comment
 225 | ERROR   | Missing parameter type
 226 | ERROR   | Missing parameter comment
 226 | ERROR   | Missing parameter type
 227 | ERROR   | Missing parameter comment
 227 | ERROR   | Missing parameter type
 229 | ERROR   | Description for the @return value is missing
 246 | ERROR   | Missing parameter comment
 246 | ERROR   | Missing parameter type
 247 | ERROR   | Missing parameter comment
 247 | ERROR   | Missing parameter type
 248 | ERROR   | Missing parameter comment
 258 | WARNING | Line exceeds 80 characters; contains 86 characters
 260 | ERROR   | Missing parameter comment
 260 | ERROR   | Missing parameter type
 261 | ERROR   | Missing parameter comment
 261 | ERROR   | Missing parameter type
 262 | ERROR   | Missing parameter comment
 276 | ERROR   | Missing parameter comment
 276 | ERROR   | Missing parameter type
 277 | ERROR   | Missing parameter comment
 277 | ERROR   | Missing parameter type
 278 | ERROR   | Missing parameter comment
 278 | ERROR   | Doc comment for parameter $vid does not match actual variable name $tid
 290 | ERROR   | Missing parameter type
 294 | ERROR   | Missing parameter type
 296 | ERROR   | Missing parameter type
 299 | ERROR   | Description for the @return value must be on the next line
 317 | ERROR   | Doc comment short description must be on a single line, further text should be a separate paragraph
 319 | ERROR   | Missing parameter comment
 319 | ERROR   | Missing parameter type
 320 | ERROR   | Missing parameter comment
 321 | ERROR   | Missing parameter comment
 323 | ERROR   | Description for the @return value is missing
 344 | ERROR   | sizeof() is a function name alias, use count() instead
 374 | ERROR   | Missing parameter comment
 374 | ERROR   | Missing parameter type
 386 | ERROR   | Missing parameter comment
 386 | ERROR   | Missing parameter type
 387 | ERROR   | Missing parameter comment
 387 | ERROR   | Missing parameter type
 397 | ERROR   | Missing parameter comment
 399 | ERROR   | Description for the @return value is missing
 401 | ERROR   | Type hint "array" missing for $excluded_types
 421 | ERROR   | Missing parameter comment
 421 | ERROR   | Missing parameter type
 422 | ERROR   | Missing parameter comment
 422 | ERROR   | Missing parameter type
 424 | ERROR   | Description for the @return value is missing
---------------------------------------------------------------------------------------------------------------------


FILE: .../contrib/hashtags/src/Form/ConfirmDeleteForm.php
--------------------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 1 WARNING AFFECTING 8 LINES
--------------------------------------------------------------------------------------------------------------------
 10 | ERROR   | Doc comment is empty
 14 | ERROR   | Class property $entity_type should use lowerCamel naming without underscores
 14 | ERROR   | Missing member variable doc comment
 15 | ERROR   | Missing member variable doc comment
 29 | WARNING | Only string literals should be passed to t() where possible
 42 | ERROR   | Missing short description in doc comment
 44 | ERROR   | Description for the @return value is missing
 54 | ERROR   | Doc comment short description must be on a single line, further text should be a separate paragraph
 63 | ERROR   | Doc comment is empty
--------------------------------------------------------------------------------------------------------------------


FILE: .../contrib/hashtags/src/Form/ManagerForm.php
----------------------------------------------------------------------------------------------------
FOUND 11 ERRORS AFFECTING 8 LINES
----------------------------------------------------------------------------------------------------
  16 | ERROR | Doc comment is empty
  24 | ERROR | Public method name "ManagerForm::getFormID" is not in lowerCamel format
 225 | ERROR | Missing parameter comment
 225 | ERROR | Missing parameter type
 226 | ERROR | Missing parameter comment
 226 | ERROR | Missing parameter type
 227 | ERROR | Missing parameter comment
 227 | ERROR | Missing parameter type
 228 | ERROR | Missing parameter comment
 230 | ERROR | Description for the @return value is missing
 232 | ERROR | Type hint "array" missing for $term_bundles
----------------------------------------------------------------------------------------------------


FILE: .../contrib/hashtags/src/Form/SettingsForm.php
--------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------------------------
  8 | ERROR   | Doc comment is empty
 28 | ERROR   | Doc comment short description must be on a single line, further text should be a separate paragraph
 71 | WARNING | Possible useless method overriding detected
--------------------------------------------------------------------------------------------------------------------


FILE: .../contrib/hashtags/src/Plugin/Filter/LinksConverter.php
----------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 5 WARNINGS AFFECTING 8 LINES
----------------------------------------------------------------------------------------------------------------
  9 | WARNING | Line exceeds 80 characters; contains 85 characters
 12 | ERROR   | Class property $hashtags_tids should use lowerCamel naming without underscores
 12 | ERROR   | Missing member variable doc comment
 14 | ERROR   | Doc comment is empty
 21 | ERROR   | Doc comment is empty
 26 | WARNING | Unused variable $hashtags_tids.
 36 | WARNING | Line exceeds 80 characters; contains 94 characters
 37 | WARNING | Line exceeds 80 characters; contains 116 characters
 41 | WARNING | Line exceeds 80 characters; contains 120 characters
----------------------------------------------------------------------------------------------------------------


FILE: .../contrib/hashtags/src/Plugin/Filter/FilterHashtags.php
----------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------
 8 | ERROR | Missing short description in doc comment
----------------------------------------------------------------------------------------------------------------


FILE: .../contrib/hashtags/hashtags.install
--------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------
 3 | ERROR | Missing short description in doc comment
--------------------------------------------------------------------------------------------

Time: 144ms; Memory: 12MB


I didn't fix this one because I think it needs further analysis.

FILE: .../contrib/hashtags/src/Form/SettingsForm.php
FOUND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------------------------

 71 | WARNING | Possible useless method overriding detected
--------------------------------------------------------------------------------------------------------------------

Kindly review it.

libbna’s picture

Assigned: Unassigned » libbna

I will review this.

libbna’s picture

Assigned: libbna » Unassigned
StatusFileSize
new68.39 KB

after applying #20 patch found few issues. I have resolved them and created a patch.

tmaiochi’s picture

Assigned: Unassigned » tmaiochi

I'll review this!

tmaiochi’s picture

Assigned: tmaiochi » Unassigned
StatusFileSize
new9.19 KB
new68.9 KB

In my review, I came across some errors like:
Notice: Undefined property: Drupal\hashtags\Form\ManagerForm::$entity_typeInfo in Drupal\hashtags\Form\ManagerForm->buildForm()
I realized that the wrong variable was used that's why this error triggered, after changing to the correct variable I still had another error:
Warning: Illegal string offset 'label' in Drupal\hashtags\Form\ManagerForm->buildForm()

So I decided to refactor all the code from the ManagerForm.php file and after refactoring it I tested it again and there were no more previous errors.

Kindly review it!

arpitk’s picture

Status: Needs review » Needs work
StatusFileSize
new83.96 KB

Hi I tried the patch #24 but it didnt apply cleanly.

Thanks!

keshavv’s picture

I appreciate all your efforts.

But the issue is regarding Non-existent service "entity.manager"
So please fix the issue only related to that. Otherwise we will go nowhere.

Thank you.

roshni27 made their first commit to this issue’s fork.

roshni27’s picture

Status: Needs work » Needs review

I have reviewed patches #7 and #11, and they have been applied cleanly. In both patches, the variable $this->entity_typeInfo is being used, but in the defined variable, the name is protected as $entityTypeInfo.

Even though entity_type.bundle.info is injected into the code, it is still being referenced as
$bundle_info = $this->entity_typeInfo->get('entity_type.bundle.info');
$bundles = $bundle_info->getBundleInfo($entity_type);.
I believe it would be more appropriate to use it as follows:
$bundles = $this->entityTypeBundleInfo->getBundleInfo($entity_type).
I have created a merge request. Please take a moment to review it.