Hello,
For some reason, when I'm trying to import users that are associated with group nodes some imported users do not have any referenced group nodes associated.
I've noticed that the group nodes that cannot be referenced are only nodes that have been imported via a previous feeds import. Despite this, users that are created through the user creation form CAN be associated with the group nodes that do not work through the feeds import process.
There are two php warnings that occur when an entity reference cannot be created through the feeds process:
Warning: array_keys() expects parameter 1 to be array, boolean given in entityreference_feeds_set_target() (line 132 of /home/angelo/dev/client/profiles/openatrium/modules/contrib/entityreference/entityreference.feeds.inc).
Warning: reset() expects parameter 1 to be array, null given in entityreference_feeds_set_target() (line 134 of /home/angelo/dev/client/profiles/openatrium/modules/contrib/entityreference/entityreference.feeds.inc).
This implies that for some reason
127: $handler->getReferencableEntities($value, '=')
isn't returning what it's supposed to and I'm not too sure why.
Has anyone else run into this issue?
Comments
Comment #1
captainpants CreditAttribution: captainpants commentedComment #2
captainpants CreditAttribution: captainpants commentedFixed. It turns out there were erroneous microsoft nbsp characters in the feed CSV that looked exactly like spaces. This resulted in the referenced entity not being found.
Removing these characters made the feed work correctly.
Comment #3
jadhavdevendra CreditAttribution: jadhavdevendra as a volunteer commentedI am using "Entity Reference" version 7.x-1.1, I have a user reference field in the content type.
If I am running multiple feed importers programatically using following code -
I am matching the reference by entity label.
If the user reference is not present I get these two warnings.
I do not get this error in following cases -
Not sure where should this issue go, to feeds or to entity reference.
Comment #4
jadhavdevendra CreditAttribution: jadhavdevendra as a volunteer commentedComment #5
dman CreditAttribution: dman as a volunteer and at Sparks Interactive commentedI'm getting this also. Though I do sometimes do funny things with entity lookups and tampers, tracing this notice shows that it's just native behaviour coming from entityreference_feeds_set_target()
Basically, even if the search for the entity done at
$options = $handler->getReferencableEntities($value, '=');
returns an empty array (no results, which is usually legal)
the later code there assumes there is at least one result always, and resets and manipulates the array as if it had something in it.
We still end up with the system, returning no match, but only after triggering these warnings.
Checking for empty will probably help here, like:
( this is probably not the right issue for the PHP notice warning though. I'm getting it when the referenced entity just don't exist)
Comment #6
g33kg1rl CreditAttribution: g33kg1rl commentedI am also experiencing this issue. Let me know if I can give any additional information to fix this. :)
Comment #7
dman CreditAttribution: dman as a volunteer and at Sparks Interactive commentedShifting to #2722671: Warning when feed refers to non-existing target: array_keys() expects parameter 1 to be array, boolean given in entityreference_feeds_set_target() (line 129) because the warning is unrelated to the reported issue "feed imports not working". The warning is just a later symptom that happens after the "not working" problem happens, and the warning can be triggered just by failed lookups on a working site.
Comment #8
joelpittetduplicate of #1943300: array_keys() and reset() notices in entityreference_feeds_set_target() during feed import if entity doesn't exist and #2722671: Warning when feed refers to non-existing target: array_keys() expects parameter 1 to be array, boolean given in entityreference_feeds_set_target() (line 129)