You are here

public function TMGMTJobItemController::invoke in Translation Management Tool 7

Implements EntityAPIControllerInterface.

Overrides EntityAPIController::invoke

File

controller/tmgmt.controller.job_item.inc, line 58
Contains the job item entity controller class.

Class

TMGMTJobItemController
Controller class for the job item entity.

Code

public function invoke($hook, $entity) {

  // We need to check whether the state of the job is affected by this
  // deletion.
  if ($hook == 'delete' && ($job = $entity
    ->getJob())) {

    // We only care for active jobs.
    if ($job
      ->isActive() && tmgmt_job_check_finished($job->tjid)) {

      // Mark the job as finished.
      $job
        ->finished();
    }
  }
  parent::invoke($hook, $entity);
}