1 | <?php |
||||
2 | |||||
3 | namespace Jabe\Impl\Batch; |
||||
4 | |||||
5 | use Jabe\Impl\Interceptor\CommandContext; |
||||
6 | use Jabe\Impl\JobExecutor\{ |
||||
7 | JobHandlerInterface, |
||||
8 | JobHandlerConfigurationInterface |
||||
9 | }; |
||||
10 | use Jabe\Impl\Persistence\Entity\{ |
||||
11 | ExecutionEntity, |
||||
12 | JobEntity |
||||
13 | }; |
||||
14 | use Jabe\Impl\Util\EnsureUtil; |
||||
15 | |||||
16 | class BatchSeedJobHandler implements JobHandlerInterface |
||||
17 | { |
||||
18 | public const TYPE = "batch-seed-job"; |
||||
19 | |||||
20 | public function getType(): string |
||||
21 | { |
||||
22 | return self::TYPE; |
||||
23 | } |
||||
24 | |||||
25 | public function execute(JobHandlerConfigurationInterface $configuration, ExecutionEntity $execution, CommandContext $commandContext, ?string $tenantId): void |
||||
26 | { |
||||
27 | $batchId = $configuration->getBatchId(); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
28 | $batch = $commandContext->getBatchManager()->findBatchById($configuration->getBatchId()); |
||||
29 | EnsureUtil::ensureNotNull("Batch with id '" . $this->batchId . "' cannot be found", "batch", $batch); |
||||
0 ignored issues
–
show
|
|||||
30 | |||||
31 | $batchJobHandler = $commandContext |
||||
32 | ->getProcessEngineConfiguration() |
||||
33 | ->getBatchHandlers() |
||||
0 ignored issues
–
show
The method
getBatchHandlers() does not exist on Jabe\Impl\Cfg\ProcessEngineConfigurationImpl .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||
34 | ->get($batch->getType()); |
||||
35 | |||||
36 | $done = $batchJobHandler->createJobs($batch); |
||||
37 | |||||
38 | if (!$done) { |
||||
39 | $batch->createSeedJob(); |
||||
40 | } else { |
||||
41 | // create monitor job initially without due date to |
||||
42 | // enable rapid completion of simple batches |
||||
43 | $batch->createMonitorJob(false); |
||||
44 | } |
||||
45 | } |
||||
46 | |||||
47 | public function newConfiguration(string $canonicalString): JobHandlerConfigurationInterface |
||||
48 | { |
||||
49 | return new BatchSeedJobConfiguration($canonicalString); |
||||
50 | } |
||||
51 | |||||
52 | public function onDelete(JobHandlerConfigurationInterface $configuration, JobEntity $jobEntity): void |
||||
53 | { |
||||
54 | // do nothing |
||||
55 | } |
||||
56 | } |
||||
57 |