diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-08 03:13:35 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-08 03:13:35 +0000 |
commit | a13322de6e1f130161b731384685c30f3d35d683 (patch) | |
tree | b87ada43a601638d94359b7d369b478845194cdf /engine/lib/relationships.php | |
parent | 77a4c159205dbc117dc67162d56e480ad9c0404b (diff) | |
download | elgg-a13322de6e1f130161b731384685c30f3d35d683.tar.gz elgg-a13322de6e1f130161b731384685c30f3d35d683.tar.bz2 |
Refs #1411: Added elgg_get_entity_from_relationship_count().
git-svn-id: http://code.elgg.org/elgg/trunk@7562 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/relationships.php')
-rw-r--r-- | engine/lib/relationships.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php index f19c76e8b..3e129bc79 100644 --- a/engine/lib/relationships.php +++ b/engine/lib/relationships.php @@ -440,6 +440,22 @@ $fullview = true, $listtypetoggle = false, $pagination = true) { * This is a good way to get out the users with the most friends, or the groups with the * most members. * + * @param array $options An options array compatible with + * elgg_get_entities_from_relationship() + * @return array + */ +function elgg_get_entities_from_relationship_count(array $options = array()) { + $options['selects'][] = "COUNT(e.guid) as total"; + $options['group_by'] = 'r.guid_two'; + $options['order_by'] = 'total desc'; + return elgg_get_entities_from_relationship($options); +} + +/** + * Gets the number of entities by a the number of entities related to them in a particular way. + * This is a good way to get out the users with the most friends, or the groups with the + * most members. + * * @param string $relationship The relationship eg "friends_of" * @param bool $inverse_relationship Inverse relationship owners * @param string $type The type of entity (default: all) @@ -563,7 +579,9 @@ $listtypetoggle = false, $pagination = true) { /** * Gets the number of entities by a the number of entities related to - * them in a particular way also constrained by metadata + * them in a particular way also constrained by metadata. + * + * @deprecated 1.8 * * @param string $relationship The relationship eg "friends_of" * @param int $relationship_guid The guid of the entity to use query |