Created a new content type with a field collection field that has 4 fields. I get the following error when attempting to save a node of this type or attempting to delete one. The node does get created, but it throws the same error when trying to view the node of that type.
Fatal error: Call to undefined method Drupal::entityTypeManager() in /var/www/modules/contrib/field_collection/src/Entity/FieldCollectionItem.php on line 291 Call Stack: 0.0000 262832 1. {main}() /var/www/index.php:0 0.0018 598136 2. Drupal\Core\DrupalKernel->handle() /var/www/index.php:19 0.0090 1611048 3. Stack\StackedHttpKernel->handle() /var/www/core/lib/Drupal/Core/DrupalKernel.php:637 0.0090 1611160 4. Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() /var/www/vendor/stack/builder/src/Stack/StackedHttpKernel.php:23 0.0090 1612168 5. Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() /var/www/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php:55 0.0091 1612280 6. Drupal\page_cache\StackMiddleware\PageCache->handle() /var/www/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php:71 0.0091 1612880 7. Drupal\page_cache\StackMiddleware\PageCache->pass() /var/www/core/modules/page_cache/src/StackMiddleware/PageCache.php:82 0.0091 1612960 8. Drupal\Core\StackMiddleware\KernelPreHandle->handle() /var/www/core/modules/page_cache/src/StackMiddleware/PageCache.php:103 0.0122 1882992 9. Drupal\Core\StackMiddleware\Session->handle() /var/www/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php:53 0.0142 2039864 10. Symfony\Component\HttpKernel\HttpKernel->handle() /var/www/core/lib/Drupal/Core/StackMiddleware/Session.php:62 0.0142 2040816 11. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /var/www/vendor/symfony/http-kernel/HttpKernel.php:68 0.0467 4982024 12. call_user_func_array:{/var/www/vendor/symfony/http-kernel/HttpKernel.php:147}() /var/www/vendor/symfony/http-kernel/HttpKernel.php:147 0.0467 4982224 13. Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() /var/www/vendor/symfony/http-kernel/HttpKernel.php:147 0.0467 4982480 14. Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() /var/www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:102 0.0467 4994432 15. Drupal\Core\Render\Renderer->executeInRenderContext() /var/www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:129 0.0468 4994928 16. Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() /var/www/core/lib/Drupal/Core/Render/Renderer.php:577 0.0468 4994976 17. call_user_func_array:{/var/www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:128}() /var/www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:128 0.0468 4995672 18. Drupal\Core\Controller\FormController->getContentResult() /var/www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:128 0.0490 5530880 19. Drupal\Core\Form\FormBuilder->buildForm() /var/www/core/lib/Drupal/Core/Controller/FormController.php:79 0.0598 6194816 20. Drupal\Core\Form\FormBuilder->processForm() /var/www/core/lib/Drupal/Core/Form/FormBuilder.php:319 0.0626 6323000 21. Drupal\Core\Form\FormSubmitter->doSubmitForm() /var/www/core/lib/Drupal/Core/Form/FormBuilder.php:588 0.0626 6323112 22. Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() /var/www/core/lib/Drupal/Core/Form/FormSubmitter.php:56 0.0626 6324392 23. call_user_func_array:{/var/www/core/lib/Drupal/Core/Form/FormSubmitter.php:116}() /var/www/core/lib/Drupal/Core/Form/FormSubmitter.php:116 0.0627 6324960 24. Drupal\node\Form\DeleteMultiple->submitForm() /var/www/core/lib/Drupal/Core/Form/FormSubmitter.php:116 0.0628 6326008 25. Drupal\Core\Entity\Sql\SqlContentEntityStorage->delete() /var/www/core/modules/node/src/Form/DeleteMultiple.php:174 0.0631 6335640 26. Drupal\Core\Entity\EntityStorageBase->delete() /var/www/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:697 0.0869 9401952 27. Drupal\Core\Entity\ContentEntityStorageBase->doDelete() /var/www/core/lib/Drupal/Core/Entity/EntityStorageBase.php:368 0.0870 9402432 28. Drupal\Core\Entity\ContentEntityStorageBase->invokeFieldMethod() /var/www/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:285 0.0975 9897776 29. Drupal\Core\Field\FieldItemList->delete() /var/www/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:415 0.0975 9897824 30. Drupal\Core\Field\FieldItemList->delegateMethod() /var/www/core/lib/Drupal/Core/Field/FieldItemList.php:222 0.0975 9898240 31. Drupal\field_collection\Plugin\Field\FieldType\FieldCollection->delete() /var/www/core/lib/Drupal/Core/Field/FieldItemList.php:249 0.1114 10415624 32. Drupal\field_collection\Entity\FieldCollectionItem->delete() /var/www/modules/contrib/field_collection/src/Plugin/Field/FieldType/FieldCollection.php:114 0.1114 10415760 33. Drupal\field_collection\Entity\FieldCollectionItem->getHost() /var/www/modules/contrib/field_collection/src/Entity/FieldCollectionItem.php:198 0.1114 10416136 34. Drupal\field_collection\Entity\FieldCollectionItem->getHostId() /var/www/modules/contrib/field_collection/src/Entity/FieldCollectionItem.php:274
Comment | File | Size | Author |
---|---|---|---|
#3 | field_collection-delete-error-2619282-3.patch | 726 bytes | juampynr |
|
Comments
Comment #2
mikeegoulding CreditAttribution: mikeegoulding at Ashday Interactive Systems commentedComment #3
juampynr CreditAttribution: juampynr at Lullabot commentedI can't reproduce this error. However, for consistency, we could use
$this->entityTypeManager()
instead of\Drupal::entityTypeManager()
as it is obtained this way atgetHost()
.Comment #4
balsamaReporter didn't give much info about his configuration, but to test, I created a node bundle with a single field collection field and added four plain text fields to that field collection. Then I created, modified and deleted a node of that bundle. also unable to reproduce. Then I applied this patch and repeated. Same results.
Not sure if this is the right place for this patch, but I'm marking as RTBC and I'l leave that up to the maintainer.
Comment #5
tim.plunkettCommitted, thanks!