1 | <?php |
||
2 | |||
3 | namespace Dtc\QueueBundle\Doctrine; |
||
4 | |||
5 | use Dtc\QueueBundle\Manager\ArchivableJobManager; |
||
6 | use Dtc\QueueBundle\Manager\JobTimingManager; |
||
7 | use Dtc\QueueBundle\Manager\RunManager; |
||
8 | |||
9 | abstract class BaseDoctrineJobManager extends ArchivableJobManager |
||
10 | { |
||
11 | /** Number of jobs to prune / reset / gather at a time */ |
||
12 | public const FETCH_COUNT_MIN = 100; |
||
13 | public const FETCH_COUNT_MAX = 500; |
||
14 | public const SAVE_COUNT_MIN = 10; |
||
15 | public const SAVE_COUNT_MAX = 100; |
||
16 | |||
17 | /** |
||
18 | * @var \Doctrine\Persistence\ObjectManager |
||
19 | */ |
||
20 | protected $objectManager; |
||
21 | |||
22 | /** |
||
23 | * DoctrineJobManager constructor. |
||
24 | * |
||
25 | * @param $jobClass |
||
26 | * @param $jobArchiveClass |
||
27 | */ |
||
28 | 19 | public function __construct( |
|
29 | RunManager $runManager, |
||
30 | JobTimingManager $jobTimingManager, |
||
31 | $objectManager, |
||
32 | $jobClass, |
||
33 | $jobArchiveClass |
||
34 | ) { |
||
35 | 19 | $this->objectManager = $objectManager; |
|
36 | 19 | parent::__construct($runManager, $jobTimingManager, $jobClass, $jobArchiveClass); |
|
37 | 19 | } |
|
38 | |||
39 | 7 | protected function getFetchCount($totalCount) |
|
40 | { |
||
41 | 7 | $fetchCount = intval($totalCount / 10); |
|
42 | 7 | if ($fetchCount < self::FETCH_COUNT_MIN) { |
|
43 | 7 | $fetchCount = self::FETCH_COUNT_MIN; |
|
44 | } |
||
45 | 7 | if ($fetchCount > self::FETCH_COUNT_MAX) { |
|
46 | $fetchCount = self::FETCH_COUNT_MAX; |
||
47 | } |
||
48 | |||
49 | 7 | return $fetchCount; |
|
50 | } |
||
51 | |||
52 | 6 | protected function getSaveCount($totalCount) |
|
53 | { |
||
54 | 6 | $saveCount = intval($totalCount / 10); |
|
55 | 6 | if ($saveCount < self::SAVE_COUNT_MIN) { |
|
56 | 6 | $saveCount = self::SAVE_COUNT_MIN; |
|
57 | } |
||
58 | 6 | if ($saveCount > self::SAVE_COUNT_MAX) { |
|
59 | $saveCount = self::SAVE_COUNT_MAX; |
||
60 | } |
||
61 | |||
62 | 6 | return $saveCount; |
|
63 | } |
||
64 | |||
65 | /** |
||
66 | * @return ObjectManager |
||
0 ignored issues
–
show
|
|||
67 | */ |
||
68 | 56 | public function getObjectManager() |
|
69 | { |
||
70 | 56 | return $this->objectManager; |
|
71 | } |
||
72 | |||
73 | /** |
||
74 | * @return \Doctrine\Persistence\ObjectRepository |
||
75 | */ |
||
76 | 30 | public function getRepository() |
|
77 | { |
||
78 | 30 | return $this->getObjectManager()->getRepository($this->getJobClass()); |
|
79 | } |
||
80 | |||
81 | 11 | protected function flush() |
|
82 | { |
||
83 | 11 | $this->getObjectManager()->flush(); |
|
84 | 11 | } |
|
85 | |||
86 | 22 | public function deleteJob(\Dtc\QueueBundle\Model\Job $job) |
|
87 | { |
||
88 | 22 | $this->persist($job, 'remove'); |
|
89 | 22 | } |
|
90 | |||
91 | abstract protected function persist($object, $action = 'persist'); |
||
92 | |||
93 | 9 | protected function addWorkerNameMethod(array &$criterion, $workerName = null, $method = null) |
|
94 | { |
||
95 | 9 | if (null !== $workerName) { |
|
96 | 4 | $criterion['workerName'] = $workerName; |
|
97 | } |
||
98 | 9 | if (null !== $method) { |
|
99 | 4 | $criterion['method'] = $method; |
|
100 | } |
||
101 | 9 | } |
|
102 | } |
||
103 |
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