Failed Conditions
Pull Request — develop (#6719)
by Marco
65:21
created

Configuration::setProxyDir()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 1
cts 1
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\ORM;
6
7
use Doctrine\Common\Annotations\AnnotationReader;
8
use Doctrine\Common\Annotations\AnnotationRegistry;
9
use Doctrine\Common\Annotations\CachedReader;
10
use Doctrine\Common\Cache\ArrayCache;
11
use Doctrine\Common\Cache\Cache as CacheDriver;
12
use Doctrine\Common\Persistence\ObjectRepository;
13
use Doctrine\ORM\Cache\CacheConfiguration;
14
use Doctrine\ORM\Mapping\ClassMetadataFactory;
15
use Doctrine\ORM\Mapping\DefaultEntityListenerResolver;
16
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
17
use Doctrine\ORM\Mapping\Driver\MappingDriver;
18
use Doctrine\ORM\Mapping\EntityListenerResolver;
19
use Doctrine\ORM\Mapping\Factory\DefaultNamingStrategy;
20
use Doctrine\ORM\Mapping\Factory\NamingStrategy;
21
use Doctrine\ORM\Proxy\Factory\ProxyFactory;
22
use Doctrine\ORM\Repository\DefaultRepositoryFactory;
23
use Doctrine\ORM\Repository\RepositoryFactory;
24
use ProxyManager\Configuration as ProxyManagerConfiguration;
25
use ProxyManager\Factory\LazyLoadingGhostFactory;
26
use ProxyManager\FileLocator\FileLocator;
27
use ProxyManager\GeneratorStrategy\EvaluatingGeneratorStrategy;
28
use ProxyManager\GeneratorStrategy\FileWriterGeneratorStrategy;
29
30
/**
31
 * Configuration container for all configuration options of Doctrine.
32
 * It combines all configuration options from DBAL & ORM.
33
 *
34
 * Internal note: When adding a new configuration option just write a getter/setter pair.
35
 *
36
 * @since 2.0
37
 * @author  Benjamin Eberlei <[email protected]>
38
 * @author  Guilherme Blanco <[email protected]>
39
 * @author  Jonathan Wage <[email protected]>
40
 * @author  Roman Borschel <[email protected]>
41
 */
42
class Configuration extends \Doctrine\DBAL\Configuration
43
{
44
    /**
45
     * @var ProxyManagerConfiguration|null
46
     */
47
    private $proxyManagerConfiguration;
48
49
    /**
50
     * Sets the directory where Doctrine generates any necessary proxy class files.
51
     *
52
     * @param string $dir
53
     *
54
     * @return void
55
     */
56
    public function setProxyDir($dir)
57
    {
58
        $this->attributes['proxyDir'] = $dir;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
59
60
        $this->getProxyManagerConfiguration()->setProxiesTargetDir($dir);
61
        $this->setAutoGenerateProxyClasses(ProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS);
62 2296
    }
63
64 2296
    /**
65 2296
     * Gets the directory where Doctrine generates any necessary proxy class files.
66
     *
67
     * @return string|null
68
     *
69
     * @deprecated please do not use this anymore
70
     */
71
    public function getProxyDir()
72 2293
    {
73
        return isset($this->attributes['proxyDir'])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
74 2293
            ? $this->attributes['proxyDir']
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
75 2293
            : null;
76 2293
    }
77
78
    /**
79
     * Gets the strategy for automatically generating proxy classes.
80
     *
81
     * @return int Possible values are constants of Doctrine\ORM\Proxy\Factory\ProxyFactory.
82
     *
83
     * @deprecated please do not use this anymore
84 2295
     */
85
    public function getAutoGenerateProxyClasses()
86 2295
    {
87 5
        return isset($this->attributes['autoGenerateProxyClasses'])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
88 2295
            ? $this->attributes['autoGenerateProxyClasses']
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
89
            : ProxyFactory::AUTOGENERATE_ALWAYS;
90
    }
91
92
    /**
93
     * Sets the strategy for automatically generating proxy classes.
94
     *
95
     * @param boolean|int $autoGenerate Possible values are constants of Doctrine\ORM\Proxy\Factory\ProxyFactory.
96
     *                                  True is converted to AUTOGENERATE_ALWAYS, false to AUTOGENERATE_NEVER.
97
     *
98
     * @return void
99 14
     */
100
    public function setAutoGenerateProxyClasses($autoGenerate)
101 14
    {
102 14
        $this->attributes['autoGenerateProxyClasses'] = (int) $autoGenerate;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
103
104
        $proxyManagerConfig = $this->getProxyManagerConfiguration();
105
106
        switch ((int) $autoGenerate) {
107
            case ProxyFactory::AUTOGENERATE_ALWAYS:
108
            case ProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS:
109 2292
                $proxyManagerConfig->setGeneratorStrategy(new FileWriterGeneratorStrategy(
110
                    new FileLocator($proxyManagerConfig->getProxiesTargetDir())
111 2292
                ));
112 2292
113 2292
                return;
114
            case ProxyFactory::AUTOGENERATE_NEVER:
115
            case ProxyFactory::AUTOGENERATE_EVAL:
116
            default:
117
                $proxyManagerConfig->setGeneratorStrategy(new EvaluatingGeneratorStrategy());
118
119
                return;
120
        }
121
    }
122
123 2296
    /**
124
     * Gets the namespace where proxy classes reside.
125 2296
     *
126 2296
     * @return string|null
127
     *
128
     * @deprecated please do not use this anymore
129
     */
130
    public function getProxyNamespace()
131
    {
132
        return isset($this->attributes['proxyNamespace'])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
133
            ? $this->attributes['proxyNamespace']
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
134
            : null;
135
    }
136
137
    /**
138 2295
     * Sets the namespace where proxy classes reside.
139
     *
140 2295
     * @param string $ns
141 2295
     *
142
     * @return void
143
     */
144
    public function setProxyNamespace($ns)
145
    {
146
        $this->attributes['proxyNamespace'] = $ns;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
147
148
        $this->getProxyManagerConfiguration()->setProxiesNamespace($ns);
149
    }
150
151
    /**
152 2275
     * Sets the cache driver implementation that is used for metadata caching.
153
     *
154 2275
     * @param MappingDriver $driverImpl
155
     *
156 2275
     * @return void
157
     *
158 2275
     * @todo Force parameter to be a Closure to ensure lazy evaluation
159 2275
     *       (as soon as a metadata cache is in effect, the driver never needs to initialize).
160 2275
     */
161
    public function setMetadataDriverImpl(MappingDriver $driverImpl)
162 2275
    {
163
        $this->attributes['metadataDriverImpl'] = $driverImpl;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
164
    }
165 1
166 1
    /**
167 1
     * Adds a new default annotation driver with a correctly configured annotation reader.
168
     *
169
     * @param array $paths
170
     *
171
     * @return AnnotationDriver
172
     */
173 View Code Duplication
    public function newDefaultAnnotationDriver($paths = [])
174
    {
175
        AnnotationRegistry::registerFile(__DIR__ . '/Annotation/DoctrineAnnotations.php');
0 ignored issues
show
Deprecated Code introduced by
The method Doctrine\Common\Annotati...egistry::registerFile() has been deprecated with message: this method is deprecated and will be removed in doctrine/annotations 2.0 autoloading should be deferred to the globally registered autoloader by then. For now, use @example AnnotationRegistry::registerLoader('class_exists')

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

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

Loading history...
176
177
        $reader = new CachedReader(new AnnotationReader(), new ArrayCache());
178
179 8
        return new AnnotationDriver($reader, (array) $paths);
0 ignored issues
show
Documentation introduced by
$reader is of type object<Doctrine\Common\Annotations\CachedReader>, but the function expects a object<Doctrine\Common\A...tions\AnnotationReader>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
180
    }
181 8
182 8
    /**
183
     * Adds a namespace under a certain alias.
184
     *
185
     * @param string $alias
186
     * @param string $namespace
187
     *
188
     * @return void
189
     */
190
    public function addEntityNamespace($alias, $namespace)
191
    {
192
        $this->attributes['entityNamespaces'][$alias] = $namespace;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
193 13
    }
194
195 13
    /**
196 1
     * Resolves a registered namespace alias to the full namespace.
197
     *
198
     * @param string $entityNamespaceAlias
199 13
     *
200
     * @return string
201
     *
202
     * @throws ORMException
203
     */
204
    public function getEntityNamespace($entityNamespaceAlias)
205
    {
206
        if ( ! isset($this->attributes['entityNamespaces'][$entityNamespaceAlias])) {
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
207
            throw ORMException::unknownEntityNamespace($entityNamespaceAlias);
208
        }
209 92
210
        return trim($this->attributes['entityNamespaces'][$entityNamespaceAlias], '\\');
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
211 92
    }
212 92
213
    /**
214
     * Sets the entity alias map.
215
     *
216
     * @param array $entityNamespaces
217
     *
218
     * @return void
219 1
     */
220
    public function setEntityNamespaces(array $entityNamespaces)
221 1
    {
222
        $this->attributes['entityNamespaces'] = $entityNamespaces;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
223
    }
224
225
    /**
226
     * Retrieves the list of registered entity namespace aliases.
227
     *
228
     * @return array
229
     */
230
    public function getEntityNamespaces()
231 1447
    {
232
        return $this->attributes['entityNamespaces'];
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
233 1447
    }
234 1447
235 1447
    /**
236
     * Gets the cache driver implementation that is used for the mapping metadata.
237
     *
238
     * @return MappingDriver|null
239
     *
240
     * @throws ORMException
241
     */
242
    public function getMetadataDriverImpl()
243 568
    {
244
        return isset($this->attributes['metadataDriverImpl'])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
245 568
            ? $this->attributes['metadataDriverImpl']
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
246 567
            : null;
247 568
    }
248
249
    /**
250
     * Gets the cache driver implementation that is used for the query cache (SQL cache).
251
     *
252
     * @return \Doctrine\Common\Cache\Cache|null
253
     */
254
    public function getQueryCacheImpl()
255
    {
256
        return isset($this->attributes['queryCacheImpl'])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
257 2242
            ? $this->attributes['queryCacheImpl']
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
258
            : null;
259 2242
    }
260 2242
261
    /**
262
     * Sets the cache driver implementation that is used for the query cache (SQL cache).
263
     *
264
     * @param \Doctrine\Common\Cache\Cache $cacheImpl
265
     *
266
     * @return void
267 1
     */
268
    public function setQueryCacheImpl(CacheDriver $cacheImpl)
269 1
    {
270 1
        $this->attributes['queryCacheImpl'] = $cacheImpl;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
271 1
    }
272
273
    /**
274
     * Gets the cache driver implementation that is used for the hydration cache (SQL cache).
275
     *
276
     * @return \Doctrine\Common\Cache\Cache|null
277
     */
278
    public function getHydrationCacheImpl()
279
    {
280
        return isset($this->attributes['hydrationCacheImpl'])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
281 1
            ? $this->attributes['hydrationCacheImpl']
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
282
            : null;
283 1
    }
284 1
285
    /**
286
     * Sets the cache driver implementation that is used for the hydration cache (SQL cache).
287
     *
288
     * @param \Doctrine\Common\Cache\Cache $cacheImpl
289
     *
290
     * @return void
291 2299
     */
292
    public function setHydrationCacheImpl(CacheDriver $cacheImpl)
293 2299
    {
294 2237
        $this->attributes['hydrationCacheImpl'] = $cacheImpl;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
295 2299
    }
296
297
    /**
298
     * Gets the cache driver implementation that is used for metadata caching.
299
     *
300
     * @return \Doctrine\Common\Cache\Cache|null
301
     */
302
    public function getMetadataCacheImpl()
303
    {
304
        return isset($this->attributes['metadataCacheImpl'])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
305 2242
            ? $this->attributes['metadataCacheImpl']
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
306
            : null;
307 2242
    }
308 2242
309
    /**
310
     * Sets the cache driver implementation that is used for metadata caching.
311
     *
312
     * @param \Doctrine\Common\Cache\Cache $cacheImpl
313
     *
314
     * @return void
315
     */
316
    public function setMetadataCacheImpl(CacheDriver $cacheImpl)
317
    {
318 1
        $this->attributes['metadataCacheImpl'] = $cacheImpl;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
319
    }
320 1
321 1
    /**
322
     * Adds a named DQL query to the configuration.
323
     *
324
     * @param string $name The name of the query.
325
     * @param string $dql  The DQL query string.
326
     *
327
     * @return void
328
     */
329
    public function addNamedQuery($name, $dql)
330
    {
331
        $this->attributes['namedQueries'][$name] = $dql;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
332 2
    }
333
334 2
    /**
335 2
     * Gets a previously registered named DQL query.
336
     *
337
     * @param string $name The name of the query.
338 1
     *
339
     * @return string The DQL query.
340
     *
341
     * @throws ORMException
342
     */
343
    public function getNamedQuery($name)
344
    {
345
        if ( ! isset($this->attributes['namedQueries'][$name])) {
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
346
            throw ORMException::namedQueryNotFound($name);
347
        }
348
349
        return $this->attributes['namedQueries'][$name];
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
350 1
    }
351
352 1
    /**
353 1
     * Adds a named native query to the configuration.
354
     *
355
     * @param string                 $name The name of the query.
356
     * @param string                 $sql  The native SQL query string.
357
     * @param Query\ResultSetMapping $rsm  The ResultSetMapping used for the results of the SQL query.
358
     *
359
     * @return void
360
     */
361
    public function addNamedNativeQuery($name, $sql, Query\ResultSetMapping $rsm)
362
    {
363
        $this->attributes['namedNativeQueries'][$name] = [$sql, $rsm];
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
364
    }
365 1
366
    /**
367 1
     * Gets the components of a previously registered named native query.
368
     *
369
     * @param string $name The name of the query.
370
     *
371 1
     * @return array A tuple with the first element being the SQL string and the second
372
     *               element being the ResultSetMapping.
373
     *
374
     * @throws ORMException
375
     */
376
    public function getNamedNativeQuery($name)
377
    {
378
        if ( ! isset($this->attributes['namedNativeQueries'][$name])) {
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
379
            throw ORMException::namedNativeQueryNotFound($name);
380
        }
381
382
        return $this->attributes['namedNativeQueries'][$name];
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
383 8
    }
384
385 8
    /**
386
     * Ensures that this Configuration instance contains settings that are
387 8
     * suitable for a production environment.
388 1
     *
389
     * @return void
390
     *
391 7
     * @throws ORMException If a configuration setting has a value that is not
392 1
     *                      suitable for a production environment.
393
     */
394
    public function ensureProductionSettings()
395 6
    {
396
        $queryCacheImpl = $this->getQueryCacheImpl();
397 6
398 1
        if ( ! $queryCacheImpl) {
399
            throw ORMException::queryCacheNotConfigured();
400
        }
401 5
402 1
        if ($queryCacheImpl instanceof ArrayCache) {
403
            throw ORMException::queryCacheUsesNonPersistentCache($queryCacheImpl);
404
        }
405 4
406 3
        $metadataCacheImpl = $this->getMetadataCacheImpl();
407
408 1
        if ( ! $metadataCacheImpl) {
409
            throw ORMException::metadataCacheNotConfigured();
410
        }
411
412
        if ($metadataCacheImpl instanceof ArrayCache) {
413
            throw ORMException::metadataCacheUsesNonPersistentCache($metadataCacheImpl);
414
        }
415
416
        if ($this->getAutoGenerateProxyClasses()) {
0 ignored issues
show
Deprecated Code introduced by
The method Doctrine\ORM\Configurati...oGenerateProxyClasses() has been deprecated with message: please do not use this anymore

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

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

Loading history...
417
            throw ORMException::proxyClassesAlwaysRegenerating();
418
        }
419
    }
420
421
    /**
422
     * Registers a custom DQL function that produces a string value.
423
     * Such a function can then be used in any DQL statement in any place where string
424 3
     * functions are allowed.
425
     *
426 3
     * DQL function names are case-insensitive.
427 1
     *
428
     * @param string          $name      Function name.
429
     * @param string|callable $className Class name or a callable that returns the function.
430 3
     *
431 3
     * @return void
432
     */
433
    public function addCustomStringFunction($name, $className)
434
    {
435
        $this->attributes['customStringFunctions'][strtolower($name)] = $className;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
436
    }
437
438
    /**
439
     * Gets the implementation class name of a registered custom string DQL function.
440 4
     *
441
     * @param string $name
442 4
     *
443
     * @return string|null
444 4
     */
445 3 View Code Duplication
    public function getCustomStringFunction($name)
446 4
    {
447
        $name = strtolower($name);
448
449
        return isset($this->attributes['customStringFunctions'][$name])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
450
            ? $this->attributes['customStringFunctions'][$name]
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
451
            : null;
452
    }
453
454
    /**
455
     * Sets a map of custom DQL string functions.
456
     *
457
     * Keys must be function names and values the FQCN of the implementing class.
458
     * The function names will be case-insensitive in DQL.
459
     *
460
     * Any previously added string functions are discarded.
461 1
     *
462
     * @param array $functions The map of custom DQL string functions.
463 1
     *
464 1
     * @return void
465
     */
466 1
    public function setCustomStringFunctions(array $functions)
467
    {
468
        foreach ($functions as $name => $className) {
469
            $this->addCustomStringFunction($name, $className);
470
        }
471
    }
472
473
    /**
474
     * Registers a custom DQL function that produces a numeric value.
475
     * Such a function can then be used in any DQL statement in any place where numeric
476
     * functions are allowed.
477
     *
478
     * DQL function names are case-insensitive.
479
     *
480
     * @param string          $name      Function name.
481
     * @param string|callable $className Class name or a callable that returns the function.
482 3
     *
483
     * @return void
484 3
     */
485 1
    public function addCustomNumericFunction($name, $className)
486
    {
487
        $this->attributes['customNumericFunctions'][strtolower($name)] = $className;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
488 3
    }
489 3
490
    /**
491
     * Gets the implementation class name of a registered custom numeric DQL function.
492
     *
493
     * @param string $name
494
     *
495
     * @return string|null
496
     */
497 View Code Duplication
    public function getCustomNumericFunction($name)
498 3
    {
499
        $name = strtolower($name);
500 3
501
        return isset($this->attributes['customNumericFunctions'][$name])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
502 3
            ? $this->attributes['customNumericFunctions'][$name]
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
503 3
            : null;
504 3
    }
505
506
    /**
507
     * Sets a map of custom DQL numeric functions.
508
     *
509
     * Keys must be function names and values the FQCN of the implementing class.
510
     * The function names will be case-insensitive in DQL.
511
     *
512
     * Any previously added numeric functions are discarded.
513
     *
514
     * @param array $functions The map of custom DQL numeric functions.
515
     *
516
     * @return void
517
     */
518
    public function setCustomNumericFunctions(array $functions)
519 1
    {
520
        foreach ($functions as $name => $className) {
521 1
            $this->addCustomNumericFunction($name, $className);
522 1
        }
523
    }
524 1
525
    /**
526
     * Registers a custom DQL function that produces a date/time value.
527
     * Such a function can then be used in any DQL statement in any place where date/time
528
     * functions are allowed.
529
     *
530
     * DQL function names are case-insensitive.
531
     *
532
     * @param string          $name      Function name.
533
     * @param string|callable $className Class name or a callable that returns the function.
534
     *
535
     * @return void
536
     */
537
    public function addCustomDatetimeFunction($name, $className)
538
    {
539
        $this->attributes['customDatetimeFunctions'][strtolower($name)] = $className;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
540 1
    }
541
542 1
    /**
543 1
     * Gets the implementation class name of a registered custom date/time DQL function.
544
     *
545
     * @param string $name
546 1
     *
547 1
     * @return string|null
548
     */
549 View Code Duplication
    public function getCustomDatetimeFunction($name)
550
    {
551
        $name = strtolower($name);
552
553
        return isset($this->attributes['customDatetimeFunctions'][$name])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
554
            ? $this->attributes['customDatetimeFunctions'][$name]
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
555
            : null;
556 1
    }
557
558 1
    /**
559
     * Sets a map of custom DQL date/time functions.
560 1
     *
561 1
     * Keys must be function names and values the FQCN of the implementing class.
562 1
     * The function names will be case-insensitive in DQL.
563
     *
564
     * Any previously added date/time functions are discarded.
565
     *
566
     * @param array $functions The map of custom DQL date/time functions.
567
     *
568
     * @return void
569
     */
570
    public function setCustomDatetimeFunctions(array $functions)
571
    {
572
        foreach ($functions as $name => $className) {
573
            $this->addCustomDatetimeFunction($name, $className);
574
        }
575
    }
576
577 1
    /**
578
     * Sets the custom hydrator modes in one pass.
579 1
     *
580 1
     * @param array $modes An array of ($modeName => $hydrator).
581
     *
582 1
     * @return void
583
     */
584
    public function setCustomHydrationModes($modes)
585
    {
586
        $this->attributes['customHydrationModes'] = [];
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
587
588
        foreach ($modes as $modeName => $hydrator) {
589
            $this->addCustomHydrationMode($modeName, $hydrator);
590
        }
591 1
    }
592
593 1
    /**
594
     * Gets the hydrator class for the given hydration mode name.
595 1
     *
596 1
     * @param string $modeName The hydration mode name.
597
     *
598 1
     * @return string|null The hydrator class name.
599
     */
600
    public function getCustomHydrationMode($modeName)
601
    {
602
        return isset($this->attributes['customHydrationModes'][$modeName])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
603
            ? $this->attributes['customHydrationModes'][$modeName]
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
604
            : null;
605
    }
606
607 3
    /**
608
     * Adds a custom hydration mode.
609 3
     *
610 3
     * @param string $modeName The hydration mode name.
611 3
     * @param string $hydrator The hydrator class name.
612
     *
613
     * @return void
614
     */
615
    public function addCustomHydrationMode($modeName, $hydrator)
616
    {
617
        $this->attributes['customHydrationModes'][$modeName] = $hydrator;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
618
    }
619
620
    /**
621
     * Sets a class metadata factory.
622 3
     *
623
     * @param string $cmfName
624 3
     *
625 3
     * @return void
626
     */
627
    public function setClassMetadataFactoryName($cmfName)
628
    {
629
        $this->attributes['classMetadataFactoryName'] = $cmfName;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
630
    }
631
632
    /**
633
     * @return string
634 1
     */
635
    public function getClassMetadataFactoryName()
636 1
    {
637 1
        if ( ! isset($this->attributes['classMetadataFactoryName'])) {
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
638
            $this->attributes['classMetadataFactoryName'] = ClassMetadataFactory::class;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
639
        }
640
641
        return $this->attributes['classMetadataFactoryName'];
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
642 2291
    }
643
644 2291
    /**
645 2291
     * Adds a filter to the list of possible filters.
646
     *
647
     * @param string $name      The name of the filter.
648 2291
     * @param string $className The class name of the filter.
649
     */
650
    public function addFilter($name, $className)
651
    {
652
        $this->attributes['filters'][$name] = $className;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
653
    }
654
655
    /**
656
     * Gets the class name for a given filter name.
657 46
     *
658
     * @param string $name The name of the filter.
659 46
     *
660 46
     * @return string The class name of the filter, or null if it is not
661
     *  defined.
662
     */
663
    public function getFilterClassName($name)
664
    {
665
        return isset($this->attributes['filters'][$name])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
666
            ? $this->attributes['filters'][$name]
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
667
            : null;
668
    }
669
670 45
    /**
671
     * Sets default repository class.
672 45
     *
673 45
     * @since 2.2
674 45
     *
675
     * @param string $className
676
     *
677
     * @return void
678
     *
679
     * @throws ORMException If not is a \Doctrine\Common\Persistence\ObjectRepository
680
     */
681
    public function setDefaultRepositoryClassName($className)
682
    {
683
        $reflectionClass = new \ReflectionClass($className);
684
685
        if ( ! $reflectionClass->implementsInterface(ObjectRepository::class)) {
686
            throw ORMException::invalidEntityRepository($className);
687
        }
688 3
689
        $this->attributes['defaultRepositoryClassName'] = $className;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
690 3
    }
691
692 3
    /**
693 1
     * Get default repository class.
694
     *
695
     * @since 2.2
696 2
     *
697 2
     * @return string
698
     */
699
    public function getDefaultRepositoryClassName()
700
    {
701
        return isset($this->attributes['defaultRepositoryClassName'])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
702
            ? $this->attributes['defaultRepositoryClassName']
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
703
            : EntityRepository::class;
704
    }
705
706 139
    /**
707
     * Sets naming strategy.
708 139
     *
709 2
     * @since 2.3
710 139
     *
711
     * @param NamingStrategy $namingStrategy
712
     *
713
     * @return void
714
     */
715
    public function setNamingStrategy(NamingStrategy $namingStrategy)
716
    {
717
        $this->attributes['namingStrategy'] = $namingStrategy;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
718
    }
719
720
    /**
721
     * Gets naming strategy..
722 5
     *
723
     * @since 2.3
724 5
     *
725 5
     * @return NamingStrategy
726
     */
727
    public function getNamingStrategy()
728
    {
729
        if ( ! isset($this->attributes['namingStrategy'])) {
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
730
            $this->attributes['namingStrategy'] = new DefaultNamingStrategy();
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
731
        }
732
733
        return $this->attributes['namingStrategy'];
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
734 391
    }
735
736 391
    /**
737 391
     * Set the entity listener resolver.
738
     *
739
     * @since 2.4
740 391
     * @param \Doctrine\ORM\Mapping\EntityListenerResolver $resolver
741
     */
742
    public function setEntityListenerResolver(EntityListenerResolver $resolver)
743
    {
744
        $this->attributes['entityListenerResolver'] = $resolver;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
745
    }
746
747
    /**
748
     * Get the entity listener resolver.
749
     *
750
     * @since 2.4
751
     * @return \Doctrine\ORM\Mapping\EntityListenerResolver
752 1
     */
753
    public function getEntityListenerResolver()
754 1
    {
755 1
        if ( ! isset($this->attributes['entityListenerResolver'])) {
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
756
            $this->attributes['entityListenerResolver'] = new DefaultEntityListenerResolver();
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
757
        }
758
759
        return $this->attributes['entityListenerResolver'];
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
760
    }
761
762
    /**
763
     * Set the entity repository factory.
764 1602
     *
765
     * @since 2.4
766 1602
     * @param \Doctrine\ORM\Repository\RepositoryFactory $repositoryFactory
767 1602
     */
768
    public function setRepositoryFactory(RepositoryFactory $repositoryFactory)
769
    {
770 1602
        $this->attributes['repositoryFactory'] = $repositoryFactory;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
771
    }
772
773
    /**
774
     * Get the entity repository factory.
775
     *
776
     * @since 2.4
777
     * @return \Doctrine\ORM\Repository\RepositoryFactory
778
     */
779 1
    public function getRepositoryFactory()
780
    {
781 1
        return isset($this->attributes['repositoryFactory'])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
782 1
            ? $this->attributes['repositoryFactory']
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
783
            : new DefaultRepositoryFactory();
784
    }
785
786
    /**
787
     * @since 2.5
788
     *
789
     * @return boolean
790 2291
     */
791
    public function isSecondLevelCacheEnabled()
792 2291
    {
793 2291
        return isset($this->attributes['isSecondLevelCacheEnabled'])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
794
            ? $this->attributes['isSecondLevelCacheEnabled']
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
795
            : false;
796 2291
    }
797
798
    /**
799
     * @since 2.5
800
     *
801
     * @param boolean $flag
802
     *
803
     * @return void
804
     */
805
    public function setSecondLevelCacheEnabled($flag = true)
806
    {
807
        $this->attributes['isSecondLevelCacheEnabled'] = (boolean) $flag;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
808
    }
809
810
    /**
811
     * @since 2.5
812
     *
813
     * @param \Doctrine\ORM\Cache\CacheConfiguration $cacheConfig
814
     *
815
     * @return void
816 2290
     */
817
    public function setSecondLevelCacheConfiguration(CacheConfiguration $cacheConfig)
818 2290
    {
819
        $this->attributes['secondLevelCacheConfiguration'] = $cacheConfig;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
820 2290
    }
821
822
    /**
823
     * @since 2.5
824
     *
825
     * @return  \Doctrine\ORM\Cache\CacheConfiguration|null
826
     */
827
    public function getSecondLevelCacheConfiguration()
828 2291
    {
829
        if ( ! isset($this->attributes['secondLevelCacheConfiguration']) && $this->isSecondLevelCacheEnabled()) {
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
830 2291
            $this->attributes['secondLevelCacheConfiguration'] = new CacheConfiguration();
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
831 277
        }
832 2291
833
        return isset($this->attributes['secondLevelCacheConfiguration'])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
834
            ? $this->attributes['secondLevelCacheConfiguration']
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
835
            : null;
836
    }
837
838
    /**
839
     * Returns query hints, which will be applied to every query in application
840
     *
841
     * @since 2.5
842 277
     *
843
     * @return array
844 277
     */
845 277
    public function getDefaultQueryHints()
846
    {
847
        return isset($this->attributes['defaultQueryHints']) ? $this->attributes['defaultQueryHints'] : [];
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
848
    }
849
850
    /**
851
     * Sets array of query hints, which will be applied to every query in application
852
     *
853
     * @since 2.5
854 278
     *
855
     * @param array $defaultQueryHints
856 278
     */
857 278
    public function setDefaultQueryHints(array $defaultQueryHints)
858
    {
859
        $this->attributes['defaultQueryHints'] = $defaultQueryHints;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
860
    }
861
862
    /**
863
     * Gets the value of a default query hint. If the hint name is not recognized, FALSE is returned.
864 278
     *
865
     * @since 2.5
866 278
     *
867
     * @param string $name The name of the hint.
868
     *
869
     * @return mixed The value of the hint or FALSE, if the hint name is not recognized.
870 278
     */
871 278
    public function getDefaultQueryHint($name)
872 278
    {
873
        return isset($this->attributes['defaultQueryHints'][$name])
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
874
            ? $this->attributes['defaultQueryHints'][$name]
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
875
            : false;
876
    }
877
878
    /**
879
     * Sets a default query hint. If the hint name is not recognized, it is silently ignored.
880
     *
881
     * @since 2.5
882 945
     *
883
     * @param string $name  The name of the hint.
884 945
     * @param mixed  $value The value of the hint.
885
     */
886
    public function setDefaultQueryHint($name, $value)
887
    {
888
        $this->attributes['defaultQueryHints'][$name] = $value;
0 ignored issues
show
Bug introduced by
The property attributes does not seem to exist. Did you mean _attributes?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
889
    }
890
891
    public function buildGhostObjectFactory() : LazyLoadingGhostFactory
892
    {
893
        return new LazyLoadingGhostFactory(clone $this->getProxyManagerConfiguration());
894 1
    }
895
896 1
    public function getProxyManagerConfiguration() : ProxyManagerConfiguration
897 1
    {
898
        return $this->proxyManagerConfiguration
899
            ?? $this->proxyManagerConfiguration = new ProxyManagerConfiguration();
900
    }
901
}
902