From c0412aa41a1efe0be21bdd6807280b6a55005053 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 30 Apr 2008 11:20:10 +0000 Subject: Introducing getEntitiesFromRelationship and countEntitiesFromRelationship methods on ElggEntity git-svn-id: https://code.elgg.org/elgg/trunk@577 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/entities.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'engine/lib/entities.php') diff --git a/engine/lib/entities.php b/engine/lib/entities.php index d71cf2170..9d4e9c538 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -252,6 +252,28 @@ return get_annotations_max($this->getGUID(), "","",$name); } + /** + * Gets an array of entities from a specific relationship type + * + * @param string $relationship Relationship type (eg "friends") + * @param int $limit Number of elements to return + * @param int $offset Indexing offset + * @return array|false An array of entities or false on failure + */ + function getEntitiesFromRelationship($relationship, $limit = 50, $offset = 0) { + return get_entities_from_relationship($relationship,$this->getGUID(),false,"","",9,"time_created desc",$limit,$offset); + } + + /** + * Gets the number of of entities from a specific relationship type + * + * @param string $relationship Relationship type (eg "friends") + * @return int|false The number of entities or false on failure + */ + function countEntitiesFromRelationship($relationship) { + return get_entities_from_relationship($relationship,$this->getGUID(),false,"","",9,"time_created desc",$limit,$offset,true); + } + /** * Determines whether or not the specified user (by default the current one) can edit the entity * -- cgit v1.2.3