public static function JobItem::preDelete in Translation Management Tool 8
Acts on entities before they are deleted and before hooks are invoked.
Used before the entities are deleted and before invoking the delete hook.
Parameters
\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.
\Drupal\Core\Entity\EntityInterface[] $entities: An array of entities.
Overrides EntityBase::preDelete
File
- src/
Entity/ JobItem.php, line 197
Class
- JobItem
- Entity class for the tmgmt_job_item entity.
Namespace
Drupal\tmgmt\EntityCode
public static function preDelete(EntityStorageInterface $storage, array $entities) {
// We need to check whether the state of the job is affected by this
// deletion.
foreach ($entities as $entity) {
if ($job = $entity
->getJob()) {
// We only care for active jobs.
if ($job
->isActive() && tmgmt_job_check_finished($job
->id())) {
// Mark the job as finished.
$job
->finished();
}
}
}
parent::preDelete($storage, $entities);
}