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...

Comments

fmr created an issue. See original summary.

rudolfbyker’s picture

Patch attached. Please review.

andypost’s picture

Great 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)

rudolfbyker’s picture

What's the oldest core you want to support?

andypost’s picture

At least 8.6 still supported, but probably it's safe to add new argument

chr.fritsch’s picture

Status: Needs review » Reviewed & tested by the community

It can be committed as soon as D8.8 is released.

kristen pol’s picture

Issue tags: +Drupal 9 compatibility

Per 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.

berdir’s picture

> 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.

chr.fritsch’s picture

Yes, I was thinking about adding the D8.7 dependency in #3098095: Remove deprecated code and declare 9.0 compatibility

andypost’s picture

queued for 8.7 and 8.8

berdir’s picture

Status: Reviewed & tested by the community » Needs work

\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.

andypost’s picture

berdir’s picture

Status: Needs work » Closed (duplicate)

Forgot that we had an issue already for this, even was following there. Agreed, closing as duplicate.