Hello,
I have many entity "territory", they have many relationship "has_animal" to entities "animal".
I can get all "animal" of a territory with :
elgg_get_entities_from_relationship(array(
'relationship' => 'has_animal',
'relationship_guid' => GUID_OF_THE_TERRITORY
));
But i want to get a "animal" with the title "Rabbit", i have test this but it's don't work :
elgg_get_entities_from_relationship(array(
'relationship' => 'has_animal',
'relationship_guid' => GUID_OF_THE_TERRITORY,
'metadata_name' => 'title',
'metadata_value' => 'Rabbit',
'limit' => 1
));
It's return a array empty.. :s
Good day,
Syntaxlb
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- DhrupDeScoop@Dhrup2000
DhrupDeScoop - 0 likes
- Kevin Jardine@kevin
Kevin Jardine - 0 likes
- Kevin Jardine@kevin
Kevin Jardine - 0 likes
You must log in to post replies.can't do that - entity title is not a metadata..
you need a wheres and an inner join for that, eg.
$db_prefix = elgg_get_config('dbprefix');
'joins' => array("INNER JOIN {$db_prefix}objects_entity o ON (o.guid = e.guid)")
'wheres' => array('o.title = "Rabbit"')
don't forget to use sanitize_string if generating wheres clauses from user data.