I'm using views_counter plugin by Matt Beckett (http://community.elgg.org/plugins/872625/1.1/views-counter-18x)
The plugin adds annotation called 'views_counter' to entities.
I'm trying to get entities from relationship but need to filter entities that have this annotation (actually I need to get entities that do NOT have it but I'm trying to get ones with annotation first just to see if I can even get them)
Here is the code:
$options = array(
"type" => "object",
"subtype" => "file",
"limit" => 0,
"count" => true,
//'annotation_names' => array('views_counter'),
);$options["relationship"] = FILE_TOOLS_RELATIONSHIP;
$options["relationship_guid"] = $folder_guid;
$options["inverse_relationship"] = false;
$files = elgg_get_entities_from_relationship($options);
That gets the entities (files), now I need to add filter for the views_counter annotations. I tried usin annotation_name_value_pairs but no luck:
$name_value_pairs[] = array(
'name' => 'views_counter',
'value' => ELGG_ENTITIES_ANY_VALUE,
'operand'=>'=',
);
$options["annotation_name_value_pairs"] = $name_value_pairs;
Can this be done using annotation_name_value_pairs or do I need custom Joins/Wheres ?
Thanks for the help or any suggestions.
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.
- Steve Clay@steve_clay
Steve Clay - 0 likes
You must log in to post replies.You'll have to switch your query function to elgg_get_entities_from_annotations(). This will make your relationship options ignored, so I think you'll have to use a manual join to get those working in the same query.