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);
}