protected function updatedIndex(BatchJob $dbBatchJob, kIndexJobData $data) { switch ($dbBatchJob->getStatus()) { case BatchJob::BATCHJOB_STATUS_PENDING: return kFlowHelper::handleIndexPending($dbBatchJob, $data); case BatchJob::BATCHJOB_STATUS_FINISHED: return kFlowHelper::handleIndexFinished($dbBatchJob, $data); case BatchJob::BATCHJOB_STATUS_FAILED: case BatchJob::BATCHJOB_STATUS_FATAL: return kFlowHelper::handleIndexFailed($dbBatchJob, $data); return $dbBatchJob; default: return $dbBatchJob; } }