You are here

function relation_delete_multiple in Relation 7

Deletes a relation.

Parameters

$rid: An array of numeric ids of the relation to be deleted.

5 calls to relation_delete_multiple()
MigrateDestinationRelation::bulkRollback in relation_migrate/relation_migrate.destination.inc
Delete a batch of relations at once.
RelationFeedsProcessor::entityDeleteMultiple in relation_feeds/RelationFeedsProcessor.inc
relation_delete in ./relation.module
Deletes a relation.
relation_entity_delete in ./relation.module
Implements hook_entity_delete().
relation_generate_relations in ./relation.drush.inc
Generates pseudorandom relations. Appropriate entities must already exist.
1 string reference to 'relation_delete_multiple'
MigrateDestinationRelation::bulkRollback in relation_migrate/relation_migrate.destination.inc
Delete a batch of relations at once.

File

./relation.module, line 725
Describes relations between entities.

Code

function relation_delete_multiple($rids) {
  $relations = relation_load_multiple($rids);
  foreach ($relations as $rid => $relation) {
    db_delete('relation')
      ->condition('rid', $rid)
      ->execute();
    db_delete('relation_revision')
      ->condition('rid', $rid)
      ->execute();
    module_invoke_all('entity_delete', $relation, 'relation');
    module_invoke('rules', 'invoke_event', 'relation_delete', $relation);
    field_attach_delete('relation', $relation);
    $endpoints = field_get_items('relation', $relation, 'endpoints');
    relation_clear_related_entities_cache($endpoints);
  }
}