|Issue tags:||D7 stable release blocker|
When enabling Features modules that contain field collections on a site for the first time, errors such as the one in the original summary below can be encountered. This seems to be due to how Entity API handles exports: #1864840: Change exports to be nested arrays rather than entity_import'd JSON objects provides another example of a similar export approach.
This causes a function call (
entity_import()) to occur in
featurename_default_fields(), and this fails if the fields haven't been created yet. They won't have been created yet if it's the first time turning on the feature.
Only happens if
This only happens if there are default values set from within the content type's Field Collection field. It is fine and recommended to set default values on the individual fields through
Structure -> Field collections -> [field collection] -> [field collection item field] -> edit.
Steps to reproduce
These are not tested on a clean install, but they should reproduce the issue:
- Create a Field Collection field on a content type.
- Create some fields - text fields, text areas, or ones where you can set a default value easily. Select lists caused it in my case, actually. One should be enough.
- Go back and edit the Field Collection field on the content type. Enter in a default value.
- Install Features 7.x-1.0 if not present.
- Export the Field Collection and its fields in a feature. Save it and put it in
sites/all/modules.DON'T ENABLE IT YET.
- Go back to the content type and delete the Field Collection field.
- Enable your Features module now.
Field Collection field and child field(s) get created again.
Features screen errors out. Closer examination reveals the error condition in the comments.
Comments of particular note: #13, #19, #20.
Original title: Unknown field: field_foo in EntityFieldQuery->addFieldCondition() / other errors when deleted field collection fields are purged
I created a Field Collection field with a couple of fields inside then, deciding it wasn't correct deleted the Field Collection field without removing the fields inside it first (not sure whether this would cause the problem or not) and now receive the following error when I delete a field from a content type:
EntityFieldQueryException: Unknown field: field_foo in EntityFieldQuery->addFieldCondition() (line 767 of /var/www/calendar/includes/entity.inc).
The field gets deleted in the content type, but because of this error I have to return to the content field page manually (url) and it ruins the work flow... And I have a lot of fields to get through :S
Any one have any ideas? I can remove the module, run cron etc to get rid of the errors but I'd quite like to use the module!