1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Vox\Webservice; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Persistence\ObjectRepository; |
6
|
|
|
use Metadata\MetadataFactoryInterface; |
7
|
|
|
use Vox\Webservice\Metadata\TransferMetadata; |
8
|
|
|
use Vox\Webservice\Proxy\ProxyFactory; |
9
|
|
|
use Vox\Webservice\Proxy\ProxyFactoryInterface; |
10
|
|
|
|
11
|
|
|
class TransferManager implements TransferManagerInterface |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @var UnityOfWorkInterface |
15
|
|
|
*/ |
16
|
|
|
private $unityOfWork; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var MetadataFactoryInterface |
20
|
|
|
*/ |
21
|
|
|
private $metadataFactory; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var WebserviceClientInterface |
25
|
|
|
*/ |
26
|
|
|
private $webserviceClient; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var TransferPersisterInterface |
30
|
|
|
*/ |
31
|
|
|
private $transferPersister; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var ProxyFactoryInterface |
35
|
|
|
*/ |
36
|
|
|
private $proxyFactory; |
37
|
|
|
|
38
|
13 |
|
public function __construct( |
39
|
|
|
MetadataFactoryInterface $metadataFactory, |
40
|
|
|
WebserviceClientInterface $webserviceClient, |
41
|
|
|
ProxyFactoryInterface $proxyFactory = null |
42
|
|
|
) { |
43
|
13 |
|
$this->metadataFactory = $metadataFactory; |
44
|
13 |
|
$this->webserviceClient = $webserviceClient; |
45
|
13 |
|
$this->proxyFactory = $proxyFactory ?? new ProxyFactory(); |
46
|
|
|
|
47
|
13 |
|
$this->clear(); |
48
|
13 |
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @todo injection of these objects |
52
|
|
|
* |
53
|
|
|
* @param type $objectName |
|
|
|
|
54
|
|
|
*/ |
55
|
13 |
|
public function clear($objectName = null) |
56
|
|
|
{ |
57
|
13 |
|
$this->unityOfWork = new UnityOfWork($this->metadataFactory); |
58
|
13 |
|
$this->transferPersister = new TransferPersister( |
59
|
13 |
|
$this->metadataFactory, |
60
|
13 |
|
$this->unityOfWork, |
61
|
13 |
|
$this->webserviceClient |
62
|
|
|
); |
63
|
13 |
|
} |
64
|
|
|
|
65
|
|
|
public function contains($object): bool |
66
|
|
|
{ |
67
|
|
|
return $this->unityOfWork->contains($object); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function detach($object) |
71
|
|
|
{ |
72
|
|
|
$this->unityOfWork->detach($object); |
73
|
|
|
} |
74
|
|
|
|
75
|
3 |
|
public function find($className, $id) |
76
|
|
|
{ |
77
|
3 |
|
return $this->getRepository($className)->find($id); |
78
|
|
|
} |
79
|
|
|
|
80
|
6 |
|
public function flush() |
81
|
|
|
{ |
82
|
6 |
|
foreach ($this->unityOfWork as $transfer) { |
83
|
6 |
|
$this->transferPersister->save($transfer); |
84
|
|
|
} |
85
|
6 |
|
} |
86
|
|
|
|
87
|
12 |
|
public function getClassMetadata($className): TransferMetadata |
88
|
|
|
{ |
89
|
12 |
|
if(is_object($className)) { |
90
|
|
|
$className = get_class($className); |
91
|
|
|
} |
92
|
|
|
|
93
|
12 |
|
return $this->metadataFactory->getMetadataForClass($className); |
|
|
|
|
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
public function getMetadataFactory(): MetadataFactoryInterface |
97
|
|
|
{ |
98
|
|
|
return $this->metadataFactory; |
|
|
|
|
99
|
|
|
} |
100
|
|
|
|
101
|
7 |
|
public function getRepository($className): ObjectRepository |
102
|
|
|
{ |
103
|
7 |
|
return new TransferRepository( |
104
|
7 |
|
$className, |
105
|
7 |
|
$this->webserviceClient, |
106
|
7 |
|
$this->unityOfWork, |
107
|
7 |
|
$this, |
108
|
7 |
|
$this->proxyFactory |
109
|
|
|
); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
public function initializeObject($obj) |
113
|
|
|
{ |
114
|
|
|
|
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
public function merge($object) |
118
|
|
|
{ |
119
|
|
|
|
120
|
|
|
} |
121
|
|
|
|
122
|
2 |
|
public function persist($object) |
123
|
|
|
{ |
124
|
2 |
|
$this->unityOfWork->attach($object); |
125
|
2 |
|
} |
126
|
|
|
|
127
|
|
|
public function refresh($object) |
128
|
|
|
{ |
129
|
|
|
|
130
|
|
|
} |
131
|
|
|
|
132
|
1 |
|
public function remove($object) |
133
|
|
|
{ |
134
|
1 |
|
$this->unityOfWork->remove($object); |
135
|
1 |
|
} |
136
|
|
|
} |
137
|
|
|
|
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