Passed
Push — master ( 6ef318...d98237 )
by Gerrit
14:03
created

EntityManagerDecorator::getConnection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 1
c 1
b 1
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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();
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->inner->beginTransaction() targeting Doctrine\ORM\EntityManag...ace::beginTransaction() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
47
    }
48
49
    public function transactional($func)
50
    {
51
        return $this->inner->transactional($func);
0 ignored issues
show
Deprecated Code introduced by
The function Doctrine\ORM\EntityManag...erface::transactional() has been deprecated: 2.10 Use {@link wrapInTransaction} instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

51
        return /** @scrutinizer ignore-deprecated */ $this->inner->transactional($func);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
52
    }
53
54
    public function commit()
55
    {
56
        return $this->inner->commit();
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->inner->commit() targeting Doctrine\ORM\EntityManagerInterface::commit() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
57
    }
58
59
    public function rollback()
60
    {
61
        return $this->inner->rollback();
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->inner->rollback() targeting Doctrine\ORM\EntityManagerInterface::rollback() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
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();
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->inner->close() targeting Doctrine\ORM\EntityManagerInterface::close() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
102
    }
103
104
    public function copy($entity, $deep = false)
105
    {
106
        return $this->inner->copy($entity, $deep);
0 ignored issues
show
Deprecated Code introduced by
The function Doctrine\ORM\EntityManagerInterface::copy() has been deprecated: 2.7 This method is being removed from the ORM and won't have any replacement ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

106
        return /** @scrutinizer ignore-deprecated */ $this->inner->copy($entity, $deep);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
107
    }
108
109
    public function lock($entity, $lockMode, $lockVersion = null)
110
    {
111
        return $this->inner->lock($entity, $lockMode, $lockVersion);
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->inner->lock($enti...lockMode, $lockVersion) targeting Doctrine\ORM\EntityManagerInterface::lock() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
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);
0 ignored issues
show
Deprecated Code introduced by
The function Doctrine\ORM\EntityManagerInterface::getHydrator() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

136
        return /** @scrutinizer ignore-deprecated */ $this->inner->getHydrator($hydrationMode);
Loading history...
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);
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->inner->persist($object) targeting Doctrine\Persistence\ObjectManager::persist() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
172
    }
173
174
    public function remove(object $object)
175
    {
176
        return $this->inner->remove($object);
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->inner->remove($object) targeting Doctrine\Persistence\ObjectManager::remove() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
177
    }
178
179
    public function clear()
180
    {
181
        return $this->inner->clear();
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->inner->clear() targeting Doctrine\Persistence\ObjectManager::clear() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
182
    }
183
184
    public function detach(object $object)
185
    {
186
        return $this->inner->detach($object);
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->inner->detach($object) targeting Doctrine\Persistence\ObjectManager::detach() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
187
    }
188
189
    public function refresh(object $object)
190
    {
191
        return $this->inner->refresh($object);
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->inner->refresh($object) targeting Doctrine\Persistence\ObjectManager::refresh() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
192
    }
193
194
    public function flush()
195
    {
196
        return $this->inner->flush();
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->inner->flush() targeting Doctrine\Persistence\ObjectManager::flush() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
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);
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->inner->initializeObject($obj) targeting Doctrine\Persistence\Obj...ger::initializeObject() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
217
    }
218
219
    public function contains(object $object)
220
    {
221
        return $this->inner->contains($object);
222
    }
223
}
224