0

In trying to understand the new paradigm of Dependency Injection, I attempted to install Webprofiler into my D8.6.10 project but it seemed it causes a conflict with my already installed fullcalendar_view. It has a dependency that is expecting an instance of Drupal\Core\Entity\EntityTypeManager which is important in this new world to declare what is required for your class/method to work.

Stepping through the stacktrace, at some point Drupal is aware that the fullcalendar dependency is requiring EntityTypeManager but the call is co-opted by WebProfiler into EntityManagerWrapper and it breaks the site. I could only get past it by removing the EntityTypeManager requirement. My frustration is that I'm trying to understand when I should pull this stunt to remove a requirement for things like Webprofiler and when I should not. I apologize that I don't have the means to ask a focused question because I don't have enough knowledge about this new paradigm yet.

Which is why I ask here.

Is it Webprofiler not respecting the fullcalendar_view requirement and invoking the EntityManagerWrapper or is the fullcalendar_view asking for the wrong requirement?

1 Answer 1

1

Yes, the module fullcalendar_view is probably asking for the wrong requirement. Services which implement an interface are supposed to be swappable with services implementing the same interface. So if the module has no reason to check for this specific class it should check for the interface EntityTypeManagerInterface instead.

1
  • Yes, my reading for the new paradigm aligns with your assertion. In this case, adding the requirement of EntityTypeManagerInterface here fails for the same reason. So for now, I'm striking any requirement in this construct method.
    – sam452
    Mar 5, 2019 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.