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.
I noticed a little blemish while working on #2546212: Entity view/form mode formatter/widget settings have no translation UI
EntityListBuilder is a root class which has many many children and creates a dependency on the deprecated entity.manager.
So the purpose of this issue is to fixup all children which copy this outdated practise
public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
return new static(
$entity_type,
$container->get('entity.manager')->getStorage($entity_type->id())
);
}
Comment | File | Size | Author |
---|---|---|---|
#9 | 3035383-9.patch | 20.59 KB | andypost |
#9 | interdiff.txt | 991 bytes | andypost |
#8 | interdiff.txt | 3.19 KB | andypost |
#7 | interdiff.txt | 3.93 KB | andypost |
Comments
Comment #2
martin107 CreditAttribution: martin107 as a volunteer commentedIn a few classes such as FieldConfigListBuilder.php
entity_manager, was also being using in the class.
If entity_manager goes away this is maybe a breaking change for a contrib module - core has a convention for this
DeprecatedServicePropertyTrait and where appropriate I have made use of that
Comment #4
martin107 CreditAttribution: martin107 as a volunteer commentedMy goof-up was $entity__type_manager
that well known double underscore convention for creating errors.
Comment #5
BerdirPlease always add the entity manager deprecation parent so the issues can be found easily. Also be careful to check the existing issues for overlaps, some are changing a lot of places.
This one is already in #3025427: Add @trigger_error() to deprecated EntityManager->EntityTypeBundleInfo methods I think.
You will notice that it's not always so easy, because often methods of entityManager were used that are now on different services.
That's why I'm currently working on deprecations grouped by the replacing service, like the issue above. But soon there's only EntityFieldManager and EntityTypeManager left, so in general +1 one updating all entity list builder classes together, but you might want to avoid overlaps with the above issue.
Comment #7
andypostre-roll after #3025427: Add @trigger_error() to deprecated EntityManager->EntityTypeBundleInfo methods and fix most of failures
Comment #8
andypostA bit more fixes and clean-up
Comment #9
andypostand the last one
Comment #11
BerdirLooks good I think.
I think that injecting the entity storage is something we shouldn't do, and one case injects the list of entity type definitions, that's even weirder, but changing that is not in scope of this issue.
Comment #12
andypostFiled follow-up #3038302: Do not cache entity type definitions in EntityDisplayModeListBuilder
Comment #14
catchCommitted and pushed 9c547baa7e to 8.8.x and 15332e965d to 8.7.x. Thanks!