I am importing an entity reference by label. If entity reference doesn't find a match, it throws an error:
Warning: array_keys() expects parameter 1 to be array, boolean given in entityreference_feeds_set_target() (line 131 of /sites/all/modules/contrib/entityreference/entityreference.feeds.inc).
Warning: reset() expects parameter 1 to be array, null given in entityreference_feeds_set_target() (line 133 of /sites/all/modules/contrib/entityreference/entityreference.feeds.inc).
In the feeds.inc we have:
case 'label':
$options = $handler->getReferencableEntities($value, '=');
$options = reset($options);
$etids = array_keys($options);
// Use the first matching entity.
$entity_id = reset($etids);
break;
If $options doesn't return a result, the array_keys() line causes an error.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | entityreference-set-target-notice-1943300-8.patch | 851 bytes | rudiedirkx |
Comments
Comment #1
Rob_Feature commentedThis patch is almost certainly not correct, but it fixes it until a better dev comes up with a solution.
Comment #2
derekw commentedSame issue here. This will also occur if the reference exists, but is unpublished (or the importer does not have permission).
Comment #3
tikaszvince commentedThis patch seems ok.
Comment #4
tuchoThe patch from #1 worked for me.
Comment #5
Anonymous (not verified) commentedThis patch worked for me as well.
Comment #6
hkovacs commentedpatch works for me. thanks.
Comment #7
rudiedirkx commentedPatch logic is good, but coding standards are wrong.
How can this still not be fixed? It's so simple. Maintainer, do your thing.
Comment #8
rudiedirkx commentedSame patch, with correct coding style. For my make file.
Comment #10
tessa bakkerCorrect code style now and tests are a success!
Comment #11
cdmo commentedThis patch (#8) also worked for me, no more
warnings. Agree that it's RTBC.Comment #12
jefflogan commentedI can confirm patch #8 works. +1 RTBC
Comment #13
joelpittetRTBC +1
Comment #15
spotzero commentedCommitted. And just in time for 1.2