Running any Functional test for a module that depends on default_content results in the following deprecation notice:
The entity_type.repository service must be passed to ContentEntityNormalizer::__construct(), it is required before Drupal 9.0.0.
See https://www.drupal.org/node/2549139.
This happens because the arguments passed to new Definition(...) in DefaultContentServiceProvider.php do not supply all of the arguments expected by ContentEntityNormalizer. It expects the following arguments:
LinkManagerInterface $link_manager,
EntityTypeManagerInterface $entity_type_manager,
ModuleHandlerInterface $module_handler,
EntityTypeRepositoryInterface $entity_type_repository = NULL,
EntityFieldManagerInterface $entity_field_manager = NULL
To fix this, we need to do this:
$service_definition = new Definition(TermEntityNormalizer::class, [
new Reference('hal.link_manager'),
new Reference('entity_type.manager'),
new Reference('module_handler'),
new Reference('entity_type.repository'),
new Reference('entity_field.manager'),
]);
A patch follows...
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | default_content-deprecation-3092985-2-8.x-1.x.patch | 822 bytes | rudolfbyker |
Comments
Comment #2
rudolfbykerPatch attached. Please review.
Comment #3
andypostGreat catch, meantime probably service provider should check for current service and depending on current definition to change arguments because we should support older core as well (yet)
Comment #4
rudolfbykerWhat's the oldest core you want to support?
Comment #5
andypostAt least 8.6 still supported, but probably it's safe to add new argument
Comment #6
chr.fritschIt can be committed as soon as D8.8 is released.
Comment #7
kristen polPer a Slack discussion with Gábor Hojtsy regarding usage of D9 tags (Drupal 9, Drupal 9 compatibility, Drupal 9 readiness, etc.), "Drupal 9 compatibility" should be used for contributed projects that need updating and "Drupal 9" was the old tag for D8 issues before the D9 branch was ready. Doing tag cleanup here based on that discussion.
Comment #8
berdir> It can be committed as soon as D8.8 is released.
I'd recommend to make the 8.7 dependency explicit, here or in another issue if there is one.
Comment #9
chr.fritschYes, I was thinking about adding the D8.7 dependency in #3098095: Remove deprecated code and declare 9.0 compatibility
Comment #10
andypostqueued for 8.7 and 8.8
Comment #11
berdir\Drupal\Tests\default_content\Kernel\ExporterIntegrationTest::testExportContent passes fine for me without this service at all, I think this was fixed by making parent a regular field. So DefaultContentServiceProvider and TermEntityNormalizer can be removed instead.
Comment #12
andypostFiled patch to remove term normalizer #2921377-12: When Drupal 8.6.0 is released, remove TermEntityNormalizer and tag a new release
Probably this issue could be closed as duplicate of one of related
Comment #13
berdirForgot that we had an issue already for this, even was following there. Agreed, closing as duplicate.