Problem/Motivation

Passing the entity.manager service to ContentEntityForm::__construct() is deprecated in Drupal 8.6.0 and will be removed before Drupal 9.0.0. Pass the entity.repository service instead. See https://www.drupal.org/node/2549139.

Proposed resolution

TBD

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

TBD

Comments

jrockowitz created an issue. See original summary.

jrockowitz’s picture

Title: [8.6.x] EntityManager has been split into 11 classes » [Drupal 8.6.x] EntityManager has been split into 11 classes
aheredia’s picture

StatusFileSize
new5.33 KB
aheredia’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 3: entity-repository-2985600-3.patch, failed testing. View results

aheredia’s picture

Status: Needs work » Needs review
jrockowitz’s picture

Status: Needs review » Needs work

@aheredia Thanks for this initial patch.

There are 12 usages instances of 'entity.manager' that need to be updated.

Targets
    Occurrences of 'entity.manager' in Directory /private/var/www/sites/d8_webform/web/modules/sandbox/webform
Found Occurrences  (12 usages found)
    Usage in string constants  (12 usages found)
        webform  (12 usages found)
            modules/webform_node/src/Controller  (5 usages found)
                WebformNodeReferencesListController.php  (5 usages found)
                    153 $container->get('entity.manager')->getDefinition('node'),
                    154 $container->get('entity.manager')->getStorage('node'),
                    156 $container->get('entity.manager')->getStorage('node_type'),
                    157 $container->get('entity.manager')->getStorage('field_config'),
                    158 $container->get('entity.manager')->getStorage('webform_submission'),
            src  (5 usages found)
                WebformEntityListBuilder.php  (1 usage found)
                    87 $container->get('entity.manager')->getStorage($entity_type->id()),
                WebformSubmissionListBuilder.php  (2 usages found)
                    256 $container->get('entity.manager')->getStorage($entity_type->id()),
                    257 $container->get('entity.manager'),
                WebformSubmissionStorage.php  (1 usage found)
                    67 $container->get('entity.manager'),
                WebformSubmissionViewBuilder.php  (1 usage found)
                    71 $container->get('entity.manager'),
            src/Controller  (1 usage found)
                WebformSubmissionViewController.php  (1 usage found)
                    58 $container->get('entity.manager'),
            src/Form  (1 usage found)
                WebformSubmissionDeleteForm.php  (1 usage found)
                    63 $container->get('entity.manager'),

aheredia’s picture

StatusFileSize
new10.69 KB
new4.85 KB

With the remaining entity.manager uses i don't know how exactly proceed

Because the classes they extend implements EntityManagerInterface for example EntityViewController.

public function __construct(EntityManagerInterface $entity_manager, RendererInterface $renderer) {
    $this->entityManager = $entity_manager;
    $this->renderer = $renderer;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('entity.manager'),
      $container->get('renderer')
    );
  }
aheredia’s picture

Status: Needs work » Needs review
jrockowitz’s picture

In core, there does not seem to be a way to fix the EntityViewController use of EntityManagerInterface. We are going to have leave this code AS-IS until D9.
@see \Drupal\node\Controller\NodeViewController

+++ b/src/WebformAddonsManager.php
@@ -337,6 +337,15 @@ class WebformAddonsManager implements WebformAddonsManagerInterface {
+    ];

This is a recent change that I committed last night. Can you please merge 8.x-5.x with your local branch and re-roll the patch? Thanks.

aheredia’s picture

StatusFileSize
new9.87 KB
new4.1 KB

I've fixed some issued with the last patch.

Remaining entity.mager is due inherit from classes that implements EntityMaganagerInterface. So no much more to do.

Status: Needs review » Needs work

The last submitted patch, 11: entity-repository-2985600-10.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

aheredia’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 11: entity-repository-2985600-10.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

jrockowitz’s picture

Status: Needs work » Reviewed & tested by the community

8.5.x is failing which is somewhat expected. This patch can wait until we only support 8.6.x.

idebr’s picture

Drupal 8.5.x is no longer receiving security support, so 8.6.x is now the lowest supported version for Drupal core.

jrockowitz’s picture

I am rerunning the tests and this will be committed.

jrockowitz’s picture

Status: Reviewed & tested by the community » Needs review

The patch needs to be rerolled.

jrockowitz’s picture

Status: Needs review » Needs work
jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new9.24 KB
jrockowitz’s picture

Status: Needs review » Reviewed & tested by the community
jrockowitz’s picture

Status: Reviewed & tested by the community » Fixed
Thank you for helping make the Webform module and our community a little better and stronger.

  • jrockowitz committed 5ed5683 on 8.x-5.x
    Issue #2985600 by aheredia, jrockowitz: [Drupal 8.6.x] EntityManager has...

Status: Fixed » Closed (fixed)

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