1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright (C) 2019 Gerrit Addiks. |
4
|
|
|
* This package (including this file) was released under the terms of the GPL-3.0. |
5
|
|
|
* You should have received a copy of the GNU General Public License along with this program. |
6
|
|
|
* If not, see <http://www.gnu.org/licenses/> or send me a mail so i can send you a copy. |
7
|
|
|
* |
8
|
|
|
* @license GPL-3.0 |
9
|
|
|
* |
10
|
|
|
* @author Gerrit Addiks <[email protected]> |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace Addiks\RDMBundle\Doctrine; |
14
|
|
|
|
15
|
|
|
use Addiks\RDMBundle\DataLoader\DataLoaderInterface; |
16
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
17
|
|
|
use Doctrine\ORM\Query\ResultSetMapping; |
18
|
|
|
|
19
|
|
|
class EntityManagerDecorator implements EntityManagerInterface |
20
|
|
|
{ |
21
|
|
|
|
22
|
|
|
public function __construct( |
23
|
|
|
private EntityManagerInterface $inner, |
24
|
|
|
private DataLoaderInterface $dataLoader |
25
|
|
|
) { |
26
|
|
|
$dataLoader->boot($inner); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
public function getCache() |
30
|
|
|
{ |
31
|
|
|
return $this->inner->getCache(); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function getConnection() |
35
|
|
|
{ |
36
|
|
|
return $this->inner->getConnection(); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function getExpressionBuilder() |
40
|
|
|
{ |
41
|
|
|
return $this->inner->getExpressionBuilder(); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function beginTransaction() |
45
|
|
|
{ |
46
|
|
|
return $this->inner->beginTransaction(); |
|
|
|
|
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function transactional($func) |
50
|
|
|
{ |
51
|
|
|
return $this->inner->transactional($func); |
|
|
|
|
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function commit() |
55
|
|
|
{ |
56
|
|
|
return $this->inner->commit(); |
|
|
|
|
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function rollback() |
60
|
|
|
{ |
61
|
|
|
return $this->inner->rollback(); |
|
|
|
|
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function createQuery($dql = '') |
65
|
|
|
{ |
66
|
|
|
return $this->inner->createQuery($dql); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function createNamedQuery($name) |
70
|
|
|
{ |
71
|
|
|
return $this->inner->createNamedQuery($name); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function createNativeQuery($sql, ResultSetMapping $rsm) |
75
|
|
|
{ |
76
|
|
|
return $this->inner->createNativeQuery($sql, $rsm); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function createNamedNativeQuery($name) |
80
|
|
|
{ |
81
|
|
|
return $this->inner->createNamedNativeQuery($name); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function createQueryBuilder() |
85
|
|
|
{ |
86
|
|
|
return $this->inner->createQueryBuilder(); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function getReference($entityName, $id) |
90
|
|
|
{ |
91
|
|
|
return $this->inner->getReference($entityName, $id); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function getPartialReference($entityName, $identifier) |
95
|
|
|
{ |
96
|
|
|
return $this->inner->getPartialReference($entityName, $identifier); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
public function close() |
100
|
|
|
{ |
101
|
|
|
return $this->inner->close(); |
|
|
|
|
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function copy($entity, $deep = false) |
105
|
|
|
{ |
106
|
|
|
return $this->inner->copy($entity, $deep); |
|
|
|
|
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function lock($entity, $lockMode, $lockVersion = null) |
110
|
|
|
{ |
111
|
|
|
return $this->inner->lock($entity, $lockMode, $lockVersion); |
|
|
|
|
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function getEventManager() |
115
|
|
|
{ |
116
|
|
|
return $this->inner->getEventManager(); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function getConfiguration() |
120
|
|
|
{ |
121
|
|
|
return $this->inner->getConfiguration(); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function isOpen() |
125
|
|
|
{ |
126
|
|
|
return $this->inner->isOpen(); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
public function getUnitOfWork() |
130
|
|
|
{ |
131
|
|
|
return $this->inner->getUnitOfWork(); |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
public function getHydrator($hydrationMode) |
135
|
|
|
{ |
136
|
|
|
return $this->inner->getHydrator($hydrationMode); |
|
|
|
|
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
public function newHydrator($hydrationMode) |
140
|
|
|
{ |
141
|
|
|
return $this->inner->newHydrator($hydrationMode); |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
public function getProxyFactory() |
145
|
|
|
{ |
146
|
|
|
return $this->inner->getProxyFactory(); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
public function getFilters() |
150
|
|
|
{ |
151
|
|
|
return $this->inner->getFilters(); |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
public function isFiltersStateClean() |
155
|
|
|
{ |
156
|
|
|
return $this->inner->isFiltersStateClean(); |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
public function hasFilters() |
160
|
|
|
{ |
161
|
|
|
return $this->inner->hasFilters(); |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
public function find(string $className, $id) |
165
|
|
|
{ |
166
|
|
|
return $this->inner->find($className, $id); |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
public function persist(object $object) |
170
|
|
|
{ |
171
|
|
|
return $this->inner->persist($object); |
|
|
|
|
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
public function remove(object $object) |
175
|
|
|
{ |
176
|
|
|
return $this->inner->remove($object); |
|
|
|
|
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
public function clear() |
180
|
|
|
{ |
181
|
|
|
return $this->inner->clear(); |
|
|
|
|
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
public function detach(object $object) |
185
|
|
|
{ |
186
|
|
|
return $this->inner->detach($object); |
|
|
|
|
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
public function refresh(object $object) |
190
|
|
|
{ |
191
|
|
|
return $this->inner->refresh($object); |
|
|
|
|
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
public function flush() |
195
|
|
|
{ |
196
|
|
|
return $this->inner->flush(); |
|
|
|
|
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
public function getRepository($className) |
200
|
|
|
{ |
201
|
|
|
return $this->inner->getRepository($className); |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
public function getClassMetadata($className) |
205
|
|
|
{ |
206
|
|
|
return $this->inner->getClassMetadata($className); |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
public function getMetadataFactory() |
210
|
|
|
{ |
211
|
|
|
return $this->inner->getMetadataFactory(); |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
public function initializeObject(object $obj) |
215
|
|
|
{ |
216
|
|
|
return $this->inner->initializeObject($obj); |
|
|
|
|
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
public function contains(object $object) |
220
|
|
|
{ |
221
|
|
|
return $this->inner->contains($object); |
222
|
|
|
} |
223
|
|
|
} |
224
|
|
|
|
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.