1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Dtc\QueueBundle\Doctrine; |
4
|
|
|
|
5
|
|
|
use Dtc\QueueBundle\Manager\JobTimingManager; |
6
|
|
|
use Dtc\QueueBundle\Model\JobTiming; |
7
|
|
|
|
8
|
|
|
abstract class DoctrineJobTimingManager extends JobTimingManager |
9
|
|
|
{ |
10
|
|
|
/** @var \Doctrine\Persistence\ObjectManager */ |
|
|
|
|
11
|
|
|
protected $objectManager; |
12
|
|
|
|
13
|
18 |
|
public function __construct($objectManager, $jobTimingClass, $recordTimings) |
14
|
|
|
{ |
15
|
18 |
|
$this->objectManager = $objectManager; |
16
|
18 |
|
parent::__construct($jobTimingClass, $recordTimings); |
17
|
18 |
|
} |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @return \Doctrine\Persistence\ObjectManager |
21
|
|
|
*/ |
22
|
45 |
|
public function getObjectManager() |
23
|
|
|
{ |
24
|
45 |
|
return $this->objectManager; |
25
|
|
|
} |
26
|
|
|
|
27
|
44 |
|
public function performRecording($status, \DateTime $finishedAt = null) |
28
|
|
|
{ |
29
|
44 |
|
if (null === $finishedAt) { |
30
|
43 |
|
$finishedAt = \Dtc\QueueBundle\Util\Util::getMicrotimeDateTime(); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** @var JobTiming $jobTiming */ |
34
|
44 |
|
$jobTiming = new $this->jobTimingClass(); |
35
|
44 |
|
$jobTiming->setFinishedAt($finishedAt); |
36
|
44 |
|
$jobTiming->setStatus($status); |
37
|
44 |
|
$objectManager = $this->getObjectManager(); |
38
|
44 |
|
$objectManager->persist($jobTiming); |
39
|
44 |
|
$objectManager->flush(); |
40
|
44 |
|
} |
41
|
|
|
|
42
|
|
|
abstract protected function removeOlderThan($objectName, $field, \DateTime $olderThan); |
43
|
|
|
|
44
|
|
|
abstract protected function persist($object, $action = 'persist'); |
45
|
|
|
|
46
|
|
|
public function pruneJobTimings(\DateTime $olderThan) |
47
|
|
|
{ |
48
|
|
|
return $this->removeOlderThan($this->getJobTimingClass(), 'finishedAt', $olderThan); |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|
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