Closed (cannot reproduce)
Project:
Field collection
Version:
7.x-1.0-beta8
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 May 2011 at 05:07 UTC
Updated:
7 Oct 2015 at 15:18 UTC
Jump to comment: Most recent
Comments
Comment #1
mariagwyn commentedThis also seems to be an issue on beta1.
Comment #2
RobW commentedLooks like this is an entity bug. I ran into something similar using entity_load(), when I accidentally provided a nested array as the value for the loaded $ids, throwing errors as it tried to use the nested array as a key - might be a similar mistake in entity.controller.inc.
Comment #3
RobW commentedSorry, after looking closer this probably is a field collection bug.
Comment #4
mariagwyn commentedI am not a coder, so I can't help on that end, but I can patch and test, and am happy to do so.
Comment #5
fagoDoes the error appear with the latest module versions of entity API & field-collection? If yes, does it appear for newly created host-entities + field-collections too? If still yes, please provide some more details about your configuration (field settings, formatter settings).
Comment #6
mariagwyn commentedI just upgraded to the dev versions of Fiel Collection and Entity API. I then reset the field to display as both View and List. In both cases, I received the same set of errors as above.
I have two field collections. One (Institution) has two text fields, plain format, one value allowed. The other (Education) has two text fields, one date field. In both cases, only one value for each field is allowed, but the collection itself allows multiple values. The number of warnings increases if there are values in the fields. With no values, there are six warnings. If there is data in the fields, I get eleven warnings (perhaps for the 5 fields within the two collections?).
What more can I tell you that will help?
One note: if I use a view to output these fields, the fields display just fine. It is likely that I will use a view to do this. However, since these field collections are not available on the node (again, in this case a user) edit area, there is no way to add data to these fields without showing them, which causes the error.
Comment #7
mariagwyn commentedoops, I missed your second question. I went back, tested further by creating two new collections with simple test fields. They worked just fine, added just fine, displayed just fine.
I am going to recreate my problem fields, and if all works with no further error, I will mark this closed.
Comment #8
mariagwyn commentedComment #9
nylin commentedI've updated the Entity API and the Field Collection modules to their dev releases, do I have to delete all of my already existing field collections and add them again for this to work normally? The problem is that I have ALOT of them, is there any onther way?
I would't say this issue is not quite fixed yet :)
Comment #10
gbernier commentedTo chime in we are getting this error use Field collection 7.x.1.0-beta4 and entity api 7.x.1.0-rc3
The field collections we are loading get loaded but still the warning gets thrown
Cheers,
Gene Bernier
Comment #11
TBarina commentedI have the same error with 7x.1.0-dev + entity api 7.x.1.0-rc3
Best regards
Tommaso
Comment #12
kscheirer#9 -through #11 reopened this issue - can you provide details on how to reproduce this bug? According to the original post, this occurs when you have "with all List Field and View Field collections." I've been able to create a field collection with just list values without any error. Using field-collection-7.x-1.0-beta4+14-dev and entity-7.x-1.0-rc3+11-dev.
Comment #13
sokrplare commentedI was running into this with
field_collection-7.x-1.0-beta3andentity-7.x-1.0-rc1- had the entity part of the patch from http://drupal.org/node/1003788#comment-6110312 applied to fix this.Just upgraded to
field_collection-7.x-1.0-beta3andentity-7.x-1.0and this error seems to have gone away so closing this ticket for now - if anyone else is on latest versions of these and still seeing it please reopen!Comment #14
alienzed commentedI'm getting this with field-collection-7.x-1.0-beta5 and entity-7.x-1.1 :(
Comment #15
biff45452 commentedI was getting this error and I found out that it was because I was putting the field value into entity_load like so:
It seems the error came from the fact that the value was a string and should actually be an integer so changing my code to this cleared up the errors:
Hope this helps.
Comment #16
jmuzz commentedI was not able to reproduce this. I installed the Viewfield module, created a page view for a simple content type with a few items, made a content type with a field collection that contained a viewfield, and made an instance of that content referencing my view. I was able to view the node without errors. I did not test the list field module.
Can you provide more specific steps to reproduce this error?
Comment #17
Barto.G commented#15 is the magic number.
I had the same problem and converting the entity id from string to integer fixed the problem
Thanks
Comment #18
prabeen.giri commentedI had the same problem , I also solved converting the entity ids that I got from
EntityFieldQueryto integer.From:
To:
Comment #19
jmuzz commentedComment #20
Guito339 commentedI ran into this when trying to load a full entity as opposed to an id. Silly mistake, but it happens.
My menu used the auto load arguments syntax like so:
The callback function:
Two ways to get rid of the warning:
my_module_my_callbackfunction to
$my_entityand remove the line
$my_entity = my_entity_load($my_entity_id);as you already have the full entity in $my_entity as per the auto load argument in the menu path.
I'd use the second option and let drupal make the my_entity_load function call for me, but I'm lazy.
The documentation for this is available at:
https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_menu/7
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Auto-Loader Wildcards
Registered paths may also contain special "auto-loader" wildcard components in the form of '%mymodule_abc', where the '%' part means that this path component is a wildcard, and the 'mymodule_abc' part defines the prefix for a load function, which here would be named mymodule_abc_load(). When a matching path is requested, your load function will receive as its first argument the path component in the position of the wildcard; load functions may also be passed additional arguments (see "load arguments" in the return value section below). For example, your module could register path 'my-module/%mymodule_abc/edit':
$items['my-module/%mymodule_abc/edit'] = array(
'page callback' => 'mymodule_abc_edit',
'page arguments' => array(1),
);
When path 'my-module/123/edit' is requested, your load function mymodule_abc_load() will be invoked with the argument '123', and should load and return an "abc" object with internal id 123:
function mymodule_abc_load($abc_id) {
return db_query("SELECT * FROM {mymodule_abc} WHERE abc_id = :abc_id", array(':abc_id' => $abc_id))->fetchObject();
}
This 'abc' object will then be passed into the callback functions defined for the menu item, such as the page callback function mymodule_abc_edit() to replace the integer 1 in the argument array. Note that a load function should return FALSE when it is unable to provide a loadable object. For example, the node_load() function for the 'node/%node/edit' menu item will return FALSE for the path 'node/999/edit' if a node with a node ID of 999 does not exist. The menu routing system will return a 404 error in this case.
Comment #21
drupalgideonI had this error when the field_collection_item_load() function was being called in a custom module with an empty ID. I solved it by checking that to see if the value was an integer or not and then ran the function if it was.
However, I think that the field_collection_item_load_multiple or field_collection_item_load functions should contain some basic checking to see that the passed value is an integer.
So
could become
for example. Happy to create a patch if you'd like.