DynamicLocalTasks::__construct() incorrectly type-hints its first parameter to EntityTypeManager instead of EntityTypeManagerInterface, causing conflicts with alternate implementations of the EntityTypeManager like the one in devel/webprofiler:

Recoverable fatal error: Argument 1 passed to Drupal\entity_clone\Plugin\Derivative\DynamicLocalTasks::__construct() must be an instance of Drupal\Core\Entity\EntityTypeManager, instance of Drupal\webprofiler\Entity\EntityManagerWrapper given, called in /appli/apache/current/web/modules/contrib/entity_clone/src/Plugin/Derivative/DynamicLocalTasks.php on line 50 and defined in Drupal\entity_clone\Plugin\Derivative\DynamicLocalTasks->__construct() (line 38 of modules/contrib/entity_clone/src/Plugin/Derivative/DynamicLocalTasks.php).

Comments

fgm created an issue. See original summary.

fgm’s picture

Status: Active » Needs review
StatusFileSize
new2.05 KB

Suggested patch.

Status: Needs review » Needs work

6lv1’s picture

Hello,

Good catch!

The same error is present on other pages, so I think we can extend you proposed solution to all files using EntityTypeManager.

fgm’s picture

Now we would need to fix these failing tests.

andypost’s picture

Status: Needs work » Needs review

Let's see which tests fails now

Status: Needs review » Needs work

The last submitted patch, 5: 0002-Issue-2820360-by-fgm-Fix-use-of-EntityTypeManager.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new777 bytes
new8.49 KB

One more fix, now only tests left

https://dispatcher.drupalci.org/job/drupal8_contrib_patches/2535/artifac...

Shows that search page and block can't be created

Status: Needs review » Needs work

The last submitted patch, 9: conflict_with-2820360-9.patch, failed testing.

michelle’s picture

If you have the patches from #2800203: Event dispatcher for clone events and #2706639: Support for sub-entity cloning applied, then this one chokes composer. I made a modified version based on having those two already applied and am sharing here in case anyone else has the same issue. It could be used as a re-roll if those other two issues are committed first. Otherwise, the patch in #9 is still the one for general use.

michelle’s picture

Sorry, forgot to change the comment number from the filename. Uploading a new one to fix that.

ranelpadon’s picture

This issue also happens when using the Varbase distribution which bundles the Entity Clone and Devel (Web Profiler) modules. Entity Clone is enabled by default, and once you enable the WebProfiler also, the fatal error happens. Using the idea behind the suggested patch resolves the issue.

andypost’s picture

Status: Needs work » Needs review
colan’s picture

Re-rolling #12 to be applied after #2706639: Support for sub-entity cloning. See that issue for its own prerequisites. The tests will fail as the prerequisites haven't been committed yet.

I couldn't generate an interdiff as generation failed, but here's the reject file.

The last submitted patch, 15: entity_clone-accept_entitytypemanagerinterface_instead_of_entitytypemanager-2820360-15.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

vpeltot’s picture

  • vpeltot committed 824e8fd on 8.x-1.x
    Issue #2820360 by Michelle, colan, andypost, vpeltot, fgm, Fanyalla:...
vpeltot’s picture

Status: Needs review » Fixed

Thanks @all

vpeltot’s picture

Status: Fixed » Closed (fixed)
colan’s picture

vpeltot: Thanks for committing, but please change the status to Fixed (open). If there are any problems, we can discuss while it's still open. Otherwise, the system will automatically close in 2 weeks (if there's no discussion).

anybody’s picture

A new alpha2 release would be nice, containing this fix.