Problem/Motivation
Updated to Drupal 8.6.x and encountered the following error:
TypeError: Argument 3 passed to Drupal\hal\Normalizer\EntityReferenceItemNormalizer::__construct() must implement interface Drupal\Core\Entity\EntityTypeManagerInterface or be null, instance of Drupal\Core\Extension\ModuleHandler given, called in /var/www/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 270 in Drupal\hal\Normalizer\EntityReferenceItemNormalizer->__construct() (line 59 of core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php).
Proposed resolution
Seems like we need to adust DynamicEntityReferenceServiceProvider.
I'm not entirely sure but it looks like we need to pass in entity_type.manager instead module_handler.
Remaining tasks
Reviews needed.
User interface changes
None
API changes
None
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 2970836-12-1.patch | 2.38 KB | jibran |
| #12 | 2970836-12.patch | 2.58 KB | jibran |
Comments
Comment #2
jibranThanks, for the fix.
Comment #3
berdirThat works, what I did in ERR is to copy the definition of the base class instead of hardcoding it and adding my custom addition as a setter method:
Then it's as independant as possible from core. Of course now with 8.6, the additional setter isn't needed anymore, so I can remove that at some point but it also doesn't break because of it.
Comment #4
jibranThanks, for the review and suggestion @Berdir. Implemented #3.
Comment #6
jibranComment #7
jibranComment #8
jibranComment #10
berdirDo you actaully need this stuff? You don't seem to be using this service yourself?
Comment #11
jibranYes, we are not using it but how are we suppose to set ETM? Am I missing something?
Comment #12
jibranNo, you are right we don't need that method parent constructor will work just fine.
Comment #15
alexpottThis is now breaking people's sites on 8.6.0 - see #2997848: Fatal error after updating to 8.6
Comment #16
jibranThe patches for both branches are ready just waiting for RTBC. I can commit them and create new release ASAP.
Comment #17
alexpott@jibran I think here you could use \Symfony\Component\DependencyInjection\ChildDefinition - ie. https://symfony.com/doc/current/service_container/parent_services.html
But you'll still need to copy the tags so maybe the approach here is good. @Berdir?
Comment #20
jibranThat's good enough. Thank, @alexpott, and @Berdir for the input.