Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Setter injection was used for entity handlers, but really should just use constructor injection. Also, per #2337191: Split up EntityManager into many services, EntityManager is being split into many services, and an entity form handler should depend on the specific service.
Proposed resolution
Remove the method from the interface, and the call in \Drupal\Core\Entity\EntityTypeManager::getFormObject()
Comments
Comment #2
dawehner+1
Comment #3
catchComment #4
catchDuplicate of #2716163: [META] Remove deprecated classes, methods, procedural functions and code paths outside of deprecated modules on the Drupal 9 branch
Comment #5
tim.plunkettWhen we added setEntityTypeManager, we moved the deprecation notice. It's not deprecated (not sure why), but should still be removed.
Comment #6
catchIt needs to be deprecated first then, and it's still used once in core so that also needs to be converted.
Comment #7
BerdirNot convinced about this at all. EntityForm needs the entity type manager, for example in \Drupal\Core\Entity\EntityForm::getEntityFromRouteMatch(). So we can't remove it, we could just switch to constructor injection. And that would break every single subclass that injects its own classes.
Comment #12
andypostComment #14
BerdirStill -1 on that, like I was 2+ years ago :) We also undeprecated (or plan to) EntityHandlerBase with similar arguments. So I'm closing this, if someone disagrees they are free to re-open this issue.