The User profile for my site contains the Entity Reference field 'Parent' which points to another User.
I have the entityreference_backreference
module enabled on my Drupal 7 site.
I need to programmatically access the values of the properties added to the user entity by the entityreference_backreference
module, so that for User A, I can identify all other Users which point to A via the 'Parent' EntityReference field.
If I do the following
$wrapper = entity_metadata_wrapper("user",$some_user);
$wrapper->getPropertyInfo();
I can see that that an entry for the entityreference_backreference field field_parent_user_eb is available in the getPropertyInfo()
output. So the property does exist.
However, if I do
$wrapper->get('field_parent_user_eb');
it comes back with "data = null".
Also if I just try to access $some_user->field_parent_user_eb
that also gives a null result.
It looks like the property is never being set.
What am I doing wrong? I can see that there is a "getter callback" defined for the field_parent_user_eb property, which is set to entityreference_backreference_related_entities
, but I can't see how I can use this.
Any help much appreciated!