trait JobCreatorTrait in Apigee Edge 8
A trait for all jobs that create other jobs.
Hierarchy
- trait \Drupal\apigee_edge\Job\JobCreatorTrait
File
- src/
Job/ JobCreatorTrait.php, line 27
Namespace
Drupal\apigee_edge\JobView source
trait JobCreatorTrait {
/**
* Returns the job executor service.
*
* @return \Drupal\apigee_edge\JobExecutor
* The job executor service.
*/
protected function getExecutor() : JobExecutor {
return \Drupal::service('apigee_edge.job_executor');
}
/**
* Schedules a job for execution.
*
* @param \Drupal\apigee_edge\Job\Job $job
* The job shluld be schedules.
*/
protected function scheduleJob(Job $job) {
$this
->getExecutor()
->save($job);
}
/**
* Schedules multiple jobs for execution.
*
* @param \Drupal\apigee_edge\Job\Job[] $jobs
* The array of the jobs should be scheduled.
*/
protected function scheduleJobs(array $jobs) {
$executor = $this
->getExecutor();
foreach ($jobs as $job) {
$executor
->save($job);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
JobCreatorTrait:: |
protected | function | Returns the job executor service. | |
JobCreatorTrait:: |
protected | function | Schedules a job for execution. | |
JobCreatorTrait:: |
protected | function | Schedules multiple jobs for execution. |