프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$db | |||
$entities | |||
$events | |||
$metadata |
메소드 | 설명 | |
---|---|---|
__construct ( |
Constructor | |
add ( integer $guid_one, string $relationship, integer $guid_two, boolean $return_id = false ) : boolean | integer | Create a relationship between two entities. E.g. friendship, group membership, site membership. | |
check ( integer $guid_one, string $relationship, integer $guid_two ) : ElggRelationship | false | Check if a relationship exists between two entities. If so, the relationship object is returned. | |
delete ( integer $id, boolean $call_event = true ) : boolean | Delete a relationship by its ID | |
get ( integer $id ) : ElggRelationship | false | Get a relationship by its ID | |
getAll ( integer $guid, boolean $inverse_relationship = false ) : ElggRelationship[] | Get all the relationships for a given GUID. | |
getEntities ( array $options ) : ElggEntity[] | mixed | Return entities matching a given query joining against a relationship. | |
getEntitiesFromCount ( array $options = [] ) : ElggEntity[] | integer | boolean | Gets the number of entities by a the number of entities related to them in a particular way. | |
getEntityRelationshipWhereSql ( string $column, string $relationship = null, integer $relationship_guid = null, boolean $inverse_relationship = false ) : mixed | Returns SQL appropriate for relationship joins and wheres | |
getRow ( integer $id ) : stdClass | false | Get a database row from the relationship table | |
remove ( integer $guid_one, string $relationship, integer $guid_two ) : boolean | Delete a relationship between two entities. | |
removeAll ( integer $guid, string $relationship = "", boolean $inverse_relationship = false, string $type = '' ) : true | Removes all relationships originating from a particular entity | |
rowToElggRelationship ( stdClass $row ) : ElggRelationship | false | Convert a database row to a new \ElggRelationship |
public __construct ( |
||
$db | Elgg Database | |
$entities | Entity table | |
$metadata | Metadata table | |
$events | Events service |
public add ( integer $guid_one, string $relationship, integer $guid_two, boolean $return_id = false ) : boolean | integer | ||
$guid_one | integer | GUID of the subject entity of the relationship |
$relationship | string | Type of the relationship |
$guid_two | integer | GUID of the target entity of the relationship |
$return_id | boolean | Return the ID instead of bool? |
리턴 | boolean | integer |
public check ( integer $guid_one, string $relationship, integer $guid_two ) : ElggRelationship | false | ||
$guid_one | integer | GUID of the subject entity of the relationship |
$relationship | string | Type of the relationship |
$guid_two | integer | GUID of the target entity of the relationship |
리턴 | ElggRelationship | false | Depending on success |
public getAll ( integer $guid, boolean $inverse_relationship = false ) : ElggRelationship[] | ||
$guid | integer | GUID of the subject or target entity (see $inverse) |
$inverse_relationship | boolean | Is $guid the target of the deleted relationships? By default $guid is the subject of the relationships. |
리턴 | ElggRelationship[] |
public getEntities ( array $options ) : ElggEntity[] | mixed | ||
$options | array | Array in format: relationship => null|STR Type of the relationship. E.g. "member" relationship_guid => null|INT GUID of the subject of the relationship, unless "inverse_relationship" is set to true, in which case this will specify the target. inverse_relationship => false|BOOL Are we searching for relationship subjects? By default, the query finds targets of relationships. relationship_join_on => null|STR How the entities relate: guid (default), container_guid, or owner_guid Examples using the relationship 'friend': 1. use 'guid' if you want the user's friends 2. use 'owner_guid' if you want the entities the user's friends own (including in groups) 3. use 'container_guid' if you want the entities in the user's personal space (non-group) relationship_created_time_lower => null|INT Relationship created time lower boundary in epoch time relationship_created_time_upper => null|INT Relationship created time upper boundary in epoch time |
리턴 | ElggEntity[] | mixed | If count, int. If not count, array. false on errors. |
public getEntityRelationshipWhereSql ( string $column, string $relationship = null, integer $relationship_guid = null, boolean $inverse_relationship = false ) : mixed | ||
$column | string | Column name the GUID should be checked against. Provide in table.column format. |
$relationship | string | Type of the relationship |
$relationship_guid | integer | Entity GUID to check |
$inverse_relationship | boolean | Is $relationship_guid the target of the relationship? |
리턴 | mixed |
public removeAll ( integer $guid, string $relationship = "", boolean $inverse_relationship = false, string $type = '' ) : true | ||
$guid | integer | GUID of the subject or target entity (see $inverse) |
$relationship | string | Type of the relationship (optional, default is all relationships) |
$inverse_relationship | boolean | Is $guid the target of the deleted relationships? By default, $guid is the subject of the relationships. |
$type | string | The type of entity related to $guid (defaults to all) |
리턴 | true |
public rowToElggRelationship ( stdClass $row ) : ElggRelationship | false | ||
$row | stdClass | Database row from the relationship table |
리턴 | ElggRelationship | false |