public function TMGMTJobItemController::delete in Translation Management Tool 7
Implements EntityAPIControllerInterface.
Parameters
$transaction: Optionally a DatabaseTransaction object to use. Allows overrides to pass in their transaction object.
Overrides EntityAPIController::delete
File
- controller/
tmgmt.controller.job_item.inc, line 30 - Contains the job item entity controller class.
Class
- TMGMTJobItemController
- Controller class for the job item entity.
Code
public function delete($ids, $transaction = NULL) {
parent::delete($ids, $transaction);
// Since we are deleting one or multiple job items here we also need to
// delete the attached messages.
$query = new EntityFieldQuery();
$result = $query
->entityCondition('entity_type', 'tmgmt_message')
->propertyCondition('tjiid', $ids)
->execute();
if (!empty($result['tmgmt_message'])) {
$controller = entity_get_controller('tmgmt_message');
// We need to directly query the entity controller so we can pass on
// the transaction object.
$controller
->delete(array_keys($result['tmgmt_message']), $transaction);
}
$query = new EntityFieldQuery();
$result = $query
->entityCondition('entity_type', 'tmgmt_remote')
->propertyCondition('tjiid', $ids)
->execute();
if (!empty($result['tmgmt_remote'])) {
$controller = entity_get_controller('tmgmt_remote');
$controller
->delete(array_keys($result['tmgmt_remote']), $transaction);
}
}