Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
relationships.php
Go to the documentation of this file.
1 <?php
16 function get_relationship($id) {
17  return _elgg_services()->relationshipsTable->get($id);
18 }
19 
28  return _elgg_services()->relationshipsTable->delete($id);
29 
30 }
31 
45 function add_entity_relationship($guid_one, $relationship, $guid_two) {
46  return _elgg_services()->relationshipsTable->add($guid_one, $relationship, $guid_two);
47 }
48 
60 function check_entity_relationship($guid_one, $relationship, $guid_two) {
61  return _elgg_services()->relationshipsTable->check($guid_one, $relationship, $guid_two);
62 }
63 
75 function remove_entity_relationship($guid_one, $relationship, $guid_two) {
76  return _elgg_services()->relationshipsTable->remove($guid_one, $relationship, $guid_two);
77 }
78 
90 function remove_entity_relationships($guid, $relationship = "", $inverse_relationship = false, $type = '') {
91  return _elgg_services()->relationshipsTable->removeAll($guid, $relationship, $inverse_relationship, $type);
92 }
93 
103 function get_entity_relationships($guid, $inverse_relationship = false) {
104  return _elgg_services()->relationshipsTable->getAll($guid, $inverse_relationship);
105 }
106 
189  return _elgg_services()->relationshipsTable->getEntities($options);
190 }
191 
207 function elgg_get_entity_relationship_where_sql($column, $relationship = null,
208  $relationship_guid = null, $inverse_relationship = false) {
209  return _elgg_services()->relationshipsTable->getEntityRelationshipWhereSql(
210  $column, $relationship, $relationship_guid, $inverse_relationship);
211 }
212 
224  return elgg_list_entities($options, 'elgg_get_entities_from_relationship');
225 }
226 
238  return _elgg_services()->relationshipsTable->getEntitiesFromCount($options);
239 }
240 
252  return elgg_list_entities($options, 'elgg_get_entities_from_relationship_count');
253 }
254 
264 function _elgg_relationships_test($hook, $type, $tests) {
265  global $CONFIG;
266  $tests[] = $CONFIG->path . 'engine/tests/ElggRelationshipTest.php';
267  return $tests;
268 }
269 
270 
276  elgg_register_plugin_hook_handler('unit_test', 'system', '_elgg_relationships_test');
277 }
278 
279 return function(\Elgg\EventsService $events, \Elgg\HooksRegistrationService $hooks) {
280  $events->registerHandler('init', 'system', '_elgg_relationship_init');
281 };
get_relationship($id)
Get a relationship by its ID.
add_entity_relationship($guid_one, $relationship, $guid_two)
Create a relationship between two entities.
remove_entity_relationship($guid_one, $relationship, $guid_two)
Delete a relationship between two entities.
_elgg_relationships_test($hook, $type, $tests)
Register relationship unit tests.
$column
Definition: add.php:13
elgg_list_entities_from_relationship_count($options)
Returns a list of entities by relationship count.
$guid
Removes an admin notice.
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
Definition: elgglib.php:715
remove_entity_relationships($guid, $relationship="", $inverse_relationship=false, $type= '')
Removes all relationships originating from a particular entity.
$options
Elgg admin footer.
Definition: footer.php:6
_elgg_relationship_init()
Initialize the relationship library private.
get_entity_relationships($guid, $inverse_relationship=false)
Get all the relationships for a given GUID.
global $CONFIG
elgg_get_entity_relationship_where_sql($column, $relationship=null, $relationship_guid=null, $inverse_relationship=false)
Returns SQL appropriate for relationship joins and wheres.
check_entity_relationship($guid_one, $relationship, $guid_two)
Check if a relationship exists between two entities.
delete_relationship($id)
Delete a relationship by its ID.
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
Definition: autoloader.php:17
elgg_list_entities_from_relationship(array $options=array())
Returns a viewable list of entities by relationship.
elgg_list_entities(array $options=array(), $getter= 'elgg_get_entities', $viewer= 'elgg_view_entity_list')
Returns a string of rendered entities.
Definition: entities.php:382
elgg_get_entities_from_relationship_count(array $options=array())
Gets the number of entities by a the number of entities related to them in a particular way...
elgg_get_entities_from_relationship($options)
Return entities matching a given query joining against a relationship.
if(!$collection_name) $id
Definition: add.php:17
if(!$display_name) $type
Definition: delete.php:27