Problem/Motivation

Ever since CommentTypeDeleteForm was first created by #2228763: Create a comment-type config entity and use that as comment bundles, require selection in field settings form, the entity.manager service has been injected into this form. However, it has never been used. In addition to being unused, the entity.manager service is deprecated and should no longer be used.

Proposed resolution

The entity.manager service should not be injected into CommentTypeDeleteForm.

User interface changes

None

API changes

None. Although the protected $entityManager is removed as an instance variable and as a constructor argument, these do not constitute API changes.

Data model changes

None

Original bug report:

Problem/Motivation

CommentTypeDeleteForm class constructor use EntityManager instead of EntityManagerInterface, adding faulty dependency to EntityManager.

Proposed resolution

CommentTypeDeleteForm class constructor should be changed to use the EntityManagerInterface

User interface changes

none

API changes

none

Data model changes

none

Reference: https://www.drupal.org/core/beta-changes
Issue category Bug, because other implementations of EntityManager won't be possible
Issue priority Normal, because the impact is not that high
Disruption No disruption
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

willzyx’s picture

willzyx’s picture

Issue tags: +Faulty dependencies

tagging, so it is much easier to find these issues

willzyx’s picture

Issue summary: View changes

Added beta evaluation

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Mile23’s picture

Version: 8.1.x-dev » 8.3.x-dev
Status: Needs review » Needs work
Issue tags: +@deprecated

This bug still exists. Nice catch.

It's also true that EntityManager (and it's interface) are deprecated.

So therefore any work should also fix the deprecation. Since that would change the function signatures, we have to move it to 8.3.x.

willzyx’s picture

@Mile23 the entity.manager service is unused in CommentTypeDeleteForm. Since we are talking about changing the constructor signatures might be worth to totally remove the service usage from the class.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

TR’s picture

Title: Faulty dependency to EntityManager in Drupal\comment\Form\CommentTypeDeleteForm » Remove unused and deprecated entity.manager service injection in CommentTypeDeleteForm
Issue summary: View changes
FileSize
1.86 KB

I have re-written the issue summary.

The original issue is largely moot because the entity.manager service is never used, so instead of changing the type from EntityManager to EntityManagerInterface the injection should be removed entirely.

The attached patch removes this injection and fixes the use of the deprecated entity.manager service as well.

TR’s picture

Status: Needs work » Needs review
Berdir’s picture

Status: Needs review » Reviewed & tested by the community

I think I also did this in #2886622: Deprecate all EntityManager methods with E_USER_DEPRECATED but that is a massive patch, so happy to do a reroll there if we want to commit this first and separtely, removing services is always a bit icky, so might be better to do it as a dedicated and small patch.

There are ways to keep BC by removing the type hint but we didn't do that either in other cases that are very unlikely to be subclassed.

alexpott’s picture

@Berdir I agree doing this in a separate issue makes things a bit easier. http://grep.xnddx.ru/search?text=CommentTypeDeleteForm&filename= is nice in that nothing looks like it is subclassing it.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed d397f60 and pushed to 8.8.x. Thanks!

  • alexpott committed d397f60 on 8.8.x
    Issue #2509652 by willzyx, TR, Berdir: Remove unused and deprecated...

Status: Fixed » Closed (fixed)

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