public function BeanEntityAPIController::delete in Bean (for Drupal 7) 7
Overridden to care about reverted entities.
Overrides EntityAPIControllerExportable::delete
File
- includes/
bean.core.inc, line 469 - Bean classes and plugin interface
Class
Code
public function delete($ids, DatabaseTransaction $transaction = NULL) {
$beans = $ids ? $this
->load($ids) : array();
$deltas = array();
foreach ($beans as $bean) {
if ($bean
->internalIdentifier()) {
field_attach_delete('bean', $bean);
$deltas[] = $bean
->identifier();
}
}
if (!empty($deltas)) {
try {
// @see block_custom_block_delete_submit()
if (module_exists('block')) {
db_delete('block')
->condition('module', 'bean')
->condition('delta', $deltas)
->execute();
db_delete('block_role')
->condition('module', 'bean')
->condition('delta', $deltas)
->execute();
// @see node_form_block_custom_block_delete_submit()
db_delete('block_node_type')
->condition('module', 'bean')
->condition('delta', $deltas)
->execute();
}
} catch (Exception $e) {
if (isset($transaction)) {
$transaction
->rollback();
}
watchdog_exception('bean', $e);
throw $e;
}
}
parent::delete($ids, $transaction);
}