mmucklo /
DtcQueueBundle
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Dtc\QueueBundle\ODM; |
||
| 4 | |||
| 5 | use Doctrine\ODM\MongoDB\DocumentManager; |
||
|
0 ignored issues
–
show
|
|||
| 6 | use Dtc\GridBundle\Grid\Column\GridColumn; |
||
|
0 ignored issues
–
show
The type
Dtc\GridBundle\Grid\Column\GridColumn was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 7 | use Dtc\GridBundle\Grid\Source\ColumnExtractionTrait; |
||
|
0 ignored issues
–
show
The type
Dtc\GridBundle\Grid\Source\ColumnExtractionTrait was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 8 | use Dtc\GridBundle\Grid\Source\DocumentGridSource; |
||
|
0 ignored issues
–
show
The type
Dtc\GridBundle\Grid\Source\DocumentGridSource was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 9 | use Dtc\QueueBundle\Model\BaseJob; |
||
| 10 | |||
| 11 | class LiveJobsGridSource extends DocumentGridSource |
||
| 12 | { |
||
| 13 | 1 | use ColumnExtractionTrait; |
|
| 14 | protected $jobManager; |
||
| 15 | protected $running = false; |
||
| 16 | private $columnSource; |
||
| 17 | |||
| 18 | 1 | public function getId() |
|
| 19 | { |
||
| 20 | 1 | return 'dtc_queue.grid_source.jobs_'.($this->isRunning() ? 'running' : 'waiting').'.odm'; |
|
| 21 | } |
||
| 22 | |||
| 23 | 7 | public function setRunning($flag) |
|
| 24 | { |
||
| 25 | 7 | $this->running = $flag; |
|
| 26 | 7 | } |
|
| 27 | |||
| 28 | 2 | public function isRunning() |
|
| 29 | { |
||
| 30 | 2 | return $this->running; |
|
| 31 | } |
||
| 32 | |||
| 33 | public function setColumnSource(\Dtc\GridBundle\Grid\Source\ColumnSource $columnSource) |
||
|
0 ignored issues
–
show
The type
Dtc\GridBundle\Grid\Source\ColumnSource was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 34 | { |
||
| 35 | $this->columnSource = $columnSource; |
||
| 36 | } |
||
| 37 | |||
| 38 | 1 | protected function getRunningQueryBuilder() |
|
| 39 | { |
||
| 40 | /** @var DocumentManager $documentManager */ |
||
| 41 | 1 | $documentManager = $this->jobManager->getObjectManager(); |
|
| 42 | 1 | $builder = $documentManager->createQueryBuilder($this->jobManager->getJobClass()); |
|
| 43 | 1 | $builder->field('status')->equals(BaseJob::STATUS_RUNNING); |
|
| 44 | 1 | $builder->sort('startedAt', 'desc'); |
|
| 45 | 1 | $builder->limit($this->limit); |
|
| 46 | 1 | $builder->skip($this->offset); |
|
| 47 | |||
| 48 | 1 | return $builder; |
|
| 49 | } |
||
| 50 | |||
| 51 | 7 | public function __construct(JobManager $jobManager) |
|
| 52 | { |
||
| 53 | 7 | $this->jobManager = $jobManager; |
|
| 54 | |||
| 55 | /** @var DocumentManager $documentManager */ |
||
| 56 | 7 | $documentManager = $jobManager->getObjectManager(); |
|
| 57 | 7 | parent::__construct($documentManager, $jobManager->getJobClass()); |
|
| 58 | 7 | } |
|
| 59 | |||
| 60 | 2 | public function setColumns($columns) |
|
| 61 | { |
||
| 62 | 2 | if ($columns) { |
|
| 63 | 2 | foreach ($columns as $column) { |
|
| 64 | 2 | if ($column instanceof GridColumn) { |
|
| 65 | 2 | $column->setOption('sortable', false); |
|
| 66 | } |
||
| 67 | } |
||
| 68 | } |
||
| 69 | |||
| 70 | 2 | parent::setColumns($columns); |
|
| 71 | 2 | } |
|
| 72 | |||
| 73 | 2 | public function getColumns() |
|
| 74 | { |
||
| 75 | 2 | if ($columns = parent::getColumns()) { |
|
| 76 | 1 | return $columns; |
|
| 77 | } |
||
| 78 | |||
| 79 | 2 | if (!$this->columnSource) { |
|
| 80 | 2 | $this->autoDiscoverColumns(); |
|
| 81 | |||
| 82 | 2 | return parent::getColumns(); |
|
| 83 | } |
||
| 84 | |||
| 85 | $columnSourceInfo = $this->columnSource->getColumnSourceInfo($this->objectManager, 'Dtc\QueueBundle\Document\Job', false); |
||
| 86 | $this->setColumns($columnSourceInfo->columns); |
||
| 87 | $this->setDefaultSort($columnSourceInfo->sort); |
||
| 88 | $this->setIdColumn($columnSourceInfo->idColumn); |
||
| 89 | |||
| 90 | return parent::getColumns(); |
||
| 91 | } |
||
| 92 | |||
| 93 | 2 | public function getDefaultSort() |
|
| 94 | { |
||
| 95 | 2 | return null; |
|
| 96 | } |
||
| 97 | |||
| 98 | 1 | protected function getQueryBuilder() |
|
| 99 | { |
||
| 100 | 1 | if ($this->isRunning()) { |
|
| 101 | 1 | return $this->getRunningQueryBuilder(); |
|
| 102 | } |
||
| 103 | 1 | $builder = $this->jobManager->getJobQueryBuilder(); |
|
| 104 | 1 | $builder->limit($this->limit); |
|
| 105 | 1 | $builder->skip($this->offset); |
|
| 106 | |||
| 107 | 1 | return $builder; |
|
| 108 | } |
||
| 109 | } |
||
| 110 |
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