1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Dtc\QueueBundle\DependencyInjection\Compiler; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; |
|
|
|
|
6
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
|
|
|
7
|
|
|
|
8
|
|
|
class GridCompilerPass implements CompilerPassInterface |
9
|
|
|
{ |
10
|
|
|
use WorkerCompilerTrait; |
11
|
|
|
|
12
|
|
|
public function process(ContainerBuilder $container): void |
13
|
|
|
{ |
14
|
|
|
if (!class_exists('Dtc\GridBundle\DtcGridBundle')) { |
15
|
|
|
$container->getDefinition('dtc_queue.grid_source.jobs_waiting.odm')->setClass('Dtc\QueueBundle\ODM\StubLiveJobsGridSource'); |
16
|
|
|
$container->getDefinition('dtc_queue.grid_source.jobs_waiting.orm')->setClass('Dtc\QueueBundle\ORM\StubLiveJobsGridSource'); |
17
|
|
|
$container->getDefinition('dtc_queue.grid_source.jobs_running.odm')->setClass('Dtc\QueueBundle\ODM\StubLiveJobsGridSource'); |
18
|
|
|
$container->getDefinition('dtc_queue.grid_source.jobs_running.orm')->setClass('Dtc\QueueBundle\ORM\StubLiveJobsGridSource'); |
19
|
|
|
|
20
|
|
|
return; |
21
|
|
|
} |
22
|
|
|
$container->getDefinition('dtc_queue.grid_source.jobs_waiting.odm')->setClass('Dtc\QueueBundle\ODM\LiveJobsGridSource'); |
23
|
|
|
$container->getDefinition('dtc_queue.grid_source.jobs_waiting.orm')->setClass('Dtc\QueueBundle\ORM\LiveJobsGridSource'); |
24
|
|
|
$container->getDefinition('dtc_queue.grid_source.jobs_running.odm')->setClass('Dtc\QueueBundle\ODM\LiveJobsGridSource'); |
25
|
|
|
$container->getDefinition('dtc_queue.grid_source.jobs_running.orm')->setClass('Dtc\QueueBundle\ORM\LiveJobsGridSource'); |
26
|
|
|
$defaultManagerType = $container->getParameter('dtc_queue.manager.job'); |
27
|
|
|
$runManagerType = $container->getParameter($this->getRunManagerType($container)); |
28
|
|
|
if ('orm' === $defaultManagerType || 'orm' === $runManagerType || 'odm' === $defaultManagerType || 'odm' === $runManagerType) { |
29
|
|
|
$filename = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'dtc_grid.yaml'; |
30
|
|
|
$cacheDir = $container->getParameter('kernel.cache_dir'); |
31
|
|
|
if (class_exists('Dtc\GridBundle\Util\ColumnUtil')) { |
32
|
|
|
\Dtc\GridBundle\Util\ColumnUtil::cacheClassesFromFile($cacheDir, $filename); |
|
|
|
|
33
|
|
|
} |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
$this->addLiveJobs($container); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @throws |
41
|
|
|
*/ |
42
|
|
|
protected function addLiveJobs(ContainerBuilder $container) |
43
|
|
|
{ |
44
|
|
|
$jobReflection = new \ReflectionClass($container->getParameter('dtc_queue.class.job')); |
45
|
|
|
|
46
|
|
|
// Custom grid sources for waiting and running jobs. |
47
|
|
|
if ($jobReflection->isSubclassOf(\Dtc\QueueBundle\Document\BaseJob::class)) { |
48
|
|
|
\Dtc\GridBundle\DependencyInjection\Compiler\GridSourceCompilerPass::addGridSource($container, 'dtc_queue.grid_source.jobs_waiting.odm'); |
|
|
|
|
49
|
|
|
\Dtc\GridBundle\DependencyInjection\Compiler\GridSourceCompilerPass::addGridSource($container, 'dtc_queue.grid_source.jobs_running.odm'); |
50
|
|
|
} |
51
|
|
|
if ($jobReflection->isSubclassOf(\Dtc\QueueBundle\Entity\BaseJob::class)) { |
52
|
|
|
\Dtc\GridBundle\DependencyInjection\Compiler\GridSourceCompilerPass::addGridSource($container, 'dtc_queue.grid_source.jobs_waiting.orm'); |
53
|
|
|
\Dtc\GridBundle\DependencyInjection\Compiler\GridSourceCompilerPass::addGridSource($container, 'dtc_queue.grid_source.jobs_running.orm'); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths