Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is happening when saving a user account (Profile2 has some collections in it).
Exception: Unable to save a field collection item without a valid reference to a host entity. in FieldCollectionItemEntity->save() (line 400 of /modules/contrib/field_collection/field_collection.entity.inc).
Comment | File | Size | Author |
---|---|---|---|
#6 | field_collection-fix_host_entity_access-2834948-6.patch | 548 bytes | marco-s |
#4 | error_message.png | 174.25 KB | Anonymous (not verified) |
#4 | update_field_collection.png | 65.63 KB | Anonymous (not verified) |
Comments
Comment #2
NancyDruBTW, only for the user themselves. User/1 can save with no error.
Comment #3
NancyDruSee also #2469487: Strange message in log
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous as a volunteer commentedI have the same problem (message) when I try to update the module field collection from 7.x-1.0-beta11 to 7.x-1.0-beta12. The message appears when I run update.php
Comment #5
hazong CreditAttribution: hazong commentedHello
I have the same problem. Do you guys already find a solution?+
Cheers
Hermann
Comment #6
marco-sI had the same issue with migrations. If a node was unpublished, field-collections hadn't access to the node and therefore to its host entity. My workaround was to run the migrations with the drush parameter --user=1.
But there's a query tag added to EntityFieldQuery which allows bypassing access checks. For more info see: DANGEROUS_ACCESS_CHECK_OPT_OUT query tag added to EntityFieldQuery
I've added this tag to the EntityFieldQuery in the fetchHostDetails() method of the field-collection module. Now I can run the migrations without the user 1. (using uid 1 is deprecated)
But I'm not sure about the security impact of this change. Maybe the maintainer can give more info about that?