Failed Conditions
Pull Request — develop (#6935)
by Michael
65:23
created

Configuration::getCustomNumericFunction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
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\DBAL\Configuration as DBALConfiguration;
14
use Doctrine\ORM\Cache\CacheConfiguration;
15
use Doctrine\ORM\Mapping\ClassMetadataFactory;
16
use Doctrine\ORM\Mapping\DefaultEntityListenerResolver;
17
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
18
use Doctrine\ORM\Mapping\Driver\MappingDriver;
19
use Doctrine\ORM\Mapping\EntityListenerResolver;
20
use Doctrine\ORM\Mapping\Factory\DefaultNamingStrategy;
21
use Doctrine\ORM\Mapping\Factory\NamingStrategy;
22
use Doctrine\ORM\Proxy\Factory\ProxyFactory;
23
use Doctrine\ORM\Query\ResultSetMapping;
24
use Doctrine\ORM\Repository\DefaultRepositoryFactory;
25
use Doctrine\ORM\Repository\RepositoryFactory;
26
use ProxyManager\Configuration as ProxyManagerConfiguration;
27
use ProxyManager\Factory\LazyLoadingGhostFactory;
28
use ProxyManager\FileLocator\FileLocator;
29
use ProxyManager\GeneratorStrategy\EvaluatingGeneratorStrategy;
30
use ProxyManager\GeneratorStrategy\FileWriterGeneratorStrategy;
31
32
/**
33
 * Configuration container for all configuration options of Doctrine.
34
 * It combines all configuration options from DBAL & ORM.
35
 *
36
 * Internal note: When adding a new configuration option just write a getter/setter pair.
37
 *
38
 * @since 2.0
39
 * @author  Benjamin Eberlei <[email protected]>
40
 * @author  Guilherme Blanco <[email protected]>
41
 * @author  Jonathan Wage <[email protected]>
42
 * @author  Roman Borschel <[email protected]>
43
 */
44
class Configuration extends DBALConfiguration
45
{
46
    /**
47
     * @var ProxyManagerConfiguration|null
48
     */
49
    private $proxyManagerConfiguration;
50
51
    /**
52
     * @var MappingDriver|null
53
     */
54
    private $metadataDriver;
55
56
    /**
57
     * @var CacheDriver|null
58
     */
59
    private $queryCache;
60
61
    /**
62 2296
     * @var CacheDriver|null
63
     */
64 2296
    private $hydrationCache;
65 2296
66
    /**
67
     * @var CacheDriver|null
68
     */
69
    private $metadataCache;
70
71
    /**
72 2293
     * @var string[] indexed by alias
73
     */
74 2293
    private $entityNamespaces = [];
75 2293
76 2293
    /**
77
     * @var string[] of DQL, indexed by query name
78
     */
79
    private $namedQueries = [];
80
81
    /**
82
     * @var string[][]|ResultSetMapping[][] tuples of [$sqlString, $resultSetMapping] indexed by query name
83
     */
84 2295
    private $namedNativeQueries = [];
85
86 2295
    /**
87 5
     * @var string[][]|ResultSetMapping[][] tuples of [$sqlString, $resultSetMapping] indexed by query name
88 2295
     */
89
    private $customStringFunctions = [];
90
91
    /**
92
     * @var string[][]|ResultSetMapping[][] tuples of [$sqlString, $resultSetMapping] indexed by query name
93
     */
94
    private $customNumericFunctions = [];
95
96
    /**
97
     * @var string[][]|ResultSetMapping[][] tuples of [$sqlString, $resultSetMapping] indexed by query name
98
     */
99 14
    private $customDatetimeFunctions = [];
100
101 14
    /**
102 14
     * @var string[] of hydrator class names, indexed by mode name
103
     */
104
    private $customHydrationModes = [];
105
106
    /**
107
     * @var string
108
     */
109 2292
    private $classMetadataFactoryClassName = ClassMetadataFactory::class;
110
111 2292
    /**
112 2292
     * @var string[] of filter class names, indexed by filter name
113 2292
     */
114
    private $filters;
115
116
    /**
117
     * @var string
118
     */
119
    private $defaultRepositoryClassName = EntityRepository::class;
120
121
    /**
122
     * @var NamingStrategy|null
123 2296
     */
124
    private $namingStrategy;
125 2296
126 2296
    /**
127
     * @var EntityListenerResolver|null
128
     */
129
    private $entityListenerResolver;
130
131
    /**
132
     * @var RepositoryFactory|null
133
     */
134
    private $repositoryFactory;
135
136
    /**
137
     * @var bool
138 2295
     */
139
    private $isSecondLevelCacheEnabled = false;
140 2295
141 2295
    /**
142
     * @var CacheConfiguration|null
143
     */
144
    private $secondLevelCacheConfiguration;
145
146
    /**
147
     * @var mixed[] indexed by hint name
148
     */
149
    private $defaultQueryHints = [];
150
151
    /**
152 2275
     * Sets the directory where Doctrine generates any necessary proxy class files.
153
     */
154 2275
    public function setProxyDir(string $directory) : void
155
    {
156 2275
        $this->getProxyManagerConfiguration()->setProxiesTargetDir($directory);
157
        $this->setAutoGenerateProxyClasses(ProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS);
158 2275
    }
159 2275
160 2275
    /**
161
     * Sets the strategy for automatically generating proxy classes.
162 2275
     *
163
     * @param boolean|int $autoGenerate Possible values are constants of Doctrine\ORM\Proxy\Factory\ProxyFactory.
164
     *                                  True is converted to AUTOGENERATE_ALWAYS, false to AUTOGENERATE_NEVER.
165 1
     */
166 1
    public function setAutoGenerateProxyClasses($autoGenerate) : void
167 1
    {
168
        $proxyManagerConfig = $this->getProxyManagerConfiguration();
169
170
        switch ((int) $autoGenerate) {
171
            case ProxyFactory::AUTOGENERATE_ALWAYS:
172
            case ProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS:
173
                $proxyManagerConfig->setGeneratorStrategy(new FileWriterGeneratorStrategy(
174
                    new FileLocator($proxyManagerConfig->getProxiesTargetDir())
175
                ));
176
177
                return;
178
            case ProxyFactory::AUTOGENERATE_NEVER:
179 8
            case ProxyFactory::AUTOGENERATE_EVAL:
180
            default:
181 8
                $proxyManagerConfig->setGeneratorStrategy(new EvaluatingGeneratorStrategy());
182 8
183
                return;
184
        }
185
    }
186
187
    /**
188
     * Sets the namespace where proxy classes reside.
189
     */
190
    public function setProxyNamespace(string $namespace) : void
191
    {
192
        $this->getProxyManagerConfiguration()->setProxiesNamespace($namespace);
193 13
    }
194
195 13
    /**
196 1
     * Sets the cache driver implementation that is used for metadata caching.
197
     *
198
     * @todo Force parameter to be a Closure to ensure lazy evaluation
199 13
     *       (as soon as a metadata cache is in effect, the driver never needs to initialize).
200
     */
201
    public function setMetadataDriverImpl(MappingDriver $metadataDriver) : void
202
    {
203
        $this->metadataDriver = $metadataDriver;
204
    }
205
206
    /**
207
     * Adds a new default annotation driver with a correctly configured annotation reader.
208
     *
209 92
     * @param string[] $paths
210
     *
211 92
     * @return AnnotationDriver
212 92
     */
213
    public function newDefaultAnnotationDriver(array $paths = []) : AnnotationDriver
214
    {
215
        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...
216
217
        $reader = new CachedReader(new AnnotationReader(), new ArrayCache());
218
219 1
        return new AnnotationDriver($reader, $paths);
220
    }
221 1
222
    /**
223
     * Gets the cache driver implementation that is used for the mapping metadata.
224
     */
225
    public function getMetadataDriverImpl() : ?MappingDriver
226
    {
227
        return $this->metadataDriver;
228
    }
229
230
    /**
231 1447
     * Gets the cache driver implementation that is used for the query cache (SQL cache).
232
     */
233 1447
    public function getQueryCacheImpl() : ?CacheDriver
234 1447
    {
235 1447
        return $this->queryCache;
236
    }
237
238
    /**
239
     * Sets the cache driver implementation that is used for the query cache (SQL cache).
240
     */
241
    public function setQueryCacheImpl(CacheDriver $queryCache) : void
242
    {
243 568
        $this->queryCache = $queryCache;
244
    }
245 568
246 567
    /**
247 568
     * Gets the cache driver implementation that is used for the hydration cache (SQL cache).
248
     */
249
    public function getHydrationCacheImpl() : ?CacheDriver
250
    {
251
        return $this->hydrationCache;
252
    }
253
254
    /**
255
     * Sets the cache driver implementation that is used for the hydration cache (SQL cache).
256
     */
257 2242
    public function setHydrationCacheImpl(CacheDriver $hydrationCache) : void
258
    {
259 2242
        $this->hydrationCache = $hydrationCache;
260 2242
    }
261
262
    /**
263
     * Gets the cache driver implementation that is used for metadata caching.
264
     */
265
    public function getMetadataCacheImpl() : ?CacheDriver
266
    {
267 1
        return $this->metadataCache;
268
    }
269 1
270 1
    /**
271 1
     * Sets the cache driver implementation that is used for metadata caching.
272
     */
273
    public function setMetadataCacheImpl(CacheDriver $metadataCache) : void
274
    {
275
        $this->metadataCache = $metadataCache;
276
    }
277
278
    /**
279
     * Adds a named DQL query to the configuration.
280
     */
281 1
    public function addNamedQuery(string $queryName, string $dqlQuery) : void
282
    {
283 1
        $this->namedQueries[$queryName] = $dqlQuery;
284 1
    }
285
286
    /**
287
     * Gets a previously registered named DQL query.
288
     *
289
     * @throws ORMException
290
     */
291 2299
    public function getNamedQuery(string $queryName) : string
292
    {
293 2299
        if ( ! isset($this->namedQueries[$queryName])) {
294 2237
            throw ORMException::namedQueryNotFound($queryName);
295 2299
        }
296
297
        return $this->namedQueries[$queryName];
298
    }
299
300
    /**
301
     * Adds a named native query to the configuration.
302
     */
303
    public function addNamedNativeQuery(string $queryName, string $sql, ResultSetMapping $resultSetMapping) : void
304
    {
305 2242
        $this->namedNativeQueries[$queryName] = [$sql, $resultSetMapping];
306
    }
307 2242
308 2242
    /**
309
     * Gets the components of a previously registered named native query.
310
     *
311
     * @return string[]|ResultSetMapping[] tuple of [$sqlString, $resultSetMaping]
312
     *
313
     * @throws ORMException
314
     */
315
    public function getNamedNativeQuery(string $queryName) : array
316
    {
317
        if ( ! isset($this->namedNativeQueries[$queryName])) {
318 1
            throw ORMException::namedNativeQueryNotFound($queryName);
319
        }
320 1
321 1
        return $this->namedNativeQueries[$queryName];
322
    }
323
324
    /**
325
     * Ensures that this Configuration instance contains settings that are
326
     * suitable for a production environment.
327
     *
328
     * @throws ORMException If a configuration setting has a value that is not
329
     *                      suitable for a production environment.
330
     */
331
    public function ensureProductionSettings() : void
332 2
    {
333
        $queryCacheImpl = $this->getQueryCacheImpl();
334 2
335 2
        if ( ! $queryCacheImpl) {
336
            throw ORMException::queryCacheNotConfigured();
337
        }
338 1
339
        if ($queryCacheImpl instanceof ArrayCache) {
340
            throw ORMException::queryCacheUsesNonPersistentCache($queryCacheImpl);
341
        }
342
343
        $metadataCacheImpl = $this->getMetadataCacheImpl();
344
345
        if ( ! $metadataCacheImpl) {
346
            throw ORMException::metadataCacheNotConfigured();
347
        }
348
349
        if ($metadataCacheImpl instanceof ArrayCache) {
350 1
            throw ORMException::metadataCacheUsesNonPersistentCache($metadataCacheImpl);
351
        }
352 1
353 1
        if ($this->getProxyManagerConfiguration()->getGeneratorStrategy() instanceof EvaluatingGeneratorStrategy) {
354
            throw ORMException::proxyClassesAlwaysRegenerating();
355
        }
356
    }
357
358
    /**
359
     * Registers a custom DQL function that produces a string value.
360
     * Such a function can then be used in any DQL statement in any place where string
361
     * functions are allowed.
362
     *
363
     * DQL function names are case-insensitive.
364
     *
365 1
     * @param string|callable $classNameOrFactory Class name or a callable that returns the function.
366
     */
367 1
    public function addCustomStringFunction(string $functionName, $classNameOrFactory) : void
368
    {
369
        $this->customStringFunctions[\strtolower($functionName)] = $classNameOrFactory;
370
    }
371 1
372
    /**
373
     * Gets the implementation class name of a registered custom string DQL function.
374
     *
375
     * @return string|callable|null
376
     */
377
    public function getCustomStringFunction(string $functionName)
378
    {
379
        return $this->customStringFunctions[\strtolower($functionName)] ?? null;
380
    }
381
382
    /**
383 8
     * Sets a map of custom DQL string functions.
384
     *
385 8
     * Keys must be function names and values the FQCN of the implementing class.
386
     * The function names will be case-insensitive in DQL.
387 8
     *
388 1
     * Any previously added string functions are discarded.
389
     *
390
     * @param array $functions The map of custom DQL string functions.
391 7
     */
392 1
    public function setCustomStringFunctions(array $functions) : void
393
    {
394
        foreach ($functions as $name => $className) {
395 6
            $this->addCustomStringFunction($name, $className);
396
        }
397 6
    }
398 1
399
    /**
400
     * Registers a custom DQL function that produces a numeric value.
401 5
     * Such a function can then be used in any DQL statement in any place where numeric
402 1
     * functions are allowed.
403
     *
404
     * DQL function names are case-insensitive.
405 4
     *
406 3
     * @param string|callable $classNameOrFactory Class name or a callable that returns the function.
407
     */
408 1
    public function addCustomNumericFunction(string $functionName, $classNameOrFactory) : void
409
    {
410
        $this->customNumericFunctions[\strtolower($functionName)] = $classNameOrFactory;
411
    }
412
413
    /**
414
     * Gets the implementation class name of a registered custom numeric DQL function.
415
     *
416
     * @return string|callable|null
417
     */
418
    public function getCustomNumericFunction(string $functionName)
419
    {
420
        return $this->customNumericFunctions[\strtolower($functionName)] ?? null;
421
    }
422
423
    /**
424 3
     * Sets a map of custom DQL numeric functions.
425
     *
426 3
     * Keys must be function names and values the FQCN of the implementing class.
427 1
     * The function names will be case-insensitive in DQL.
428
     *
429
     * Any previously added numeric functions are discarded.
430 3
     *
431 3
     * @param array $functions The map of custom DQL numeric functions.
432
     */
433
    public function setCustomNumericFunctions(array $functions) : void
434
    {
435
        foreach ($functions as $name => $className) {
436
            $this->addCustomNumericFunction($name, $className);
437
        }
438
    }
439
440 4
    /**
441
     * Registers a custom DQL function that produces a date/time value.
442 4
     * Such a function can then be used in any DQL statement in any place where date/time
443
     * functions are allowed.
444 4
     *
445 3
     * DQL function names are case-insensitive.
446 4
     *
447
     * @param string|callable $classNameOrFactory Class name or a callable that returns the function.
448
     */
449
    public function addCustomDatetimeFunction(string $functionName, $classNameOrFactory)
450
    {
451
        $this->customDatetimeFunctions[\strtolower($functionName)] = $classNameOrFactory;
452
    }
453
454
    /**
455
     * Gets the implementation class name of a registered custom date/time DQL function.
456
     *
457
     * @return string|callable|null
458
     */
459
    public function getCustomDatetimeFunction(string $functionName)
460
    {
461 1
        return $this->customDatetimeFunctions[\strtolower($functionName)] ?? null;
462
    }
463 1
464 1
    /**
465
     * Sets a map of custom DQL date/time functions.
466 1
     *
467
     * Keys must be function names and values the FQCN of the implementing class.
468
     * The function names will be case-insensitive in DQL.
469
     *
470
     * Any previously added date/time functions are discarded.
471
     *
472
     * @param array $functions The map of custom DQL date/time functions.
473
     */
474
    public function setCustomDatetimeFunctions(array $functions) : void
475
    {
476
        foreach ($functions as $name => $className) {
477
            $this->addCustomDatetimeFunction($name, $className);
478
        }
479
    }
480
481
    /**
482 3
     * Sets the custom hydrator modes in one pass.
483
     *
484 3
     * @param iterable $modes An iterable of string $modeName => string $hydratorClassName
485 1
     */
486
    public function setCustomHydrationModes(iterable $modes) : void
487
    {
488 3
        $this->customHydrationModes = [];
489 3
490
        foreach ($modes as $modeName => $hydrator) {
491
            $this->addCustomHydrationMode($modeName, $hydrator);
492
        }
493
    }
494
495
    /**
496
     * Gets the hydrator class for the given hydration mode name.
497
     *
498 3
     * @return string|null The hydrator class name.
499
     */
500 3
    public function getCustomHydrationMode(string $modeName) : ?string
501
    {
502 3
        return $this->customHydrationModes[$modeName] ?? null;
503 3
    }
504 3
505
    /**
506
     * Adds a custom hydration mode.
507
     */
508
    public function addCustomHydrationMode(string $modeName, string $hydratorClassName) : void
509
    {
510
        $this->customHydrationModes[$modeName] = $hydratorClassName;
511
    }
512
513
    /**
514
     * Sets a class metadata factory.
515
     */
516
    public function setClassMetadataFactoryName(string $classMetadataFactoryClassName) : void
517
    {
518
        $this->classMetadataFactoryClassName = $classMetadataFactoryClassName;
519 1
    }
520
521 1
    public function getClassMetadataFactoryName() : string
522 1
    {
523
        return $this->classMetadataFactoryClassName;
524 1
    }
525
526
    /**
527
     * Adds a filter to the list of possible filters.
528
     */
529
    public function addFilter(string $filterName, string $filterClassName) : void
530
    {
531
        $this->filters[$filterName] = $filterClassName;
532
    }
533
534
    /**
535
     * Gets the class name for a given filter name.
536
     *
537
     * @return string|null The class name of the filter
538
     */
539
    public function getFilterClassName(string $filterName) : ?string
540 1
    {
541
        return $this->filters[$filterName] ?? null;
542 1
    }
543 1
544
    /**
545
     * Sets default repository class.
546 1
     *
547 1
     * @since 2.2
548
     *
549
     * @throws ORMException If not is a \Doctrine\Common\Persistence\ObjectRepository implementation
550
     */
551
    public function setDefaultRepositoryClassName(string $repositoryClassName) : void
552
    {
553
        $reflectionClass = new \ReflectionClass($repositoryClassName);
554
555
        if ( ! $reflectionClass->implementsInterface(ObjectRepository::class)) {
556 1
            throw ORMException::invalidEntityRepository($repositoryClassName);
557
        }
558 1
559
        $this->defaultRepositoryClassName = $repositoryClassName;
560 1
    }
561 1
562 1
    /**
563
     * Get default repository class.
564
     *
565
     * @since 2.2
566
     */
567
    public function getDefaultRepositoryClassName() : string
568
    {
569
        return $this->defaultRepositoryClassName;
570
    }
571
572
    /**
573
     * Sets naming strategy.
574
     *
575
     * @since 2.3
576
     */
577 1
    public function setNamingStrategy(NamingStrategy $namingStrategy) : void
578
    {
579 1
        $this->namingStrategy = $namingStrategy;
580 1
    }
581
582 1
    /**
583
     * Gets naming strategy..
584
     *
585
     * @since 2.3
586
     */
587
    public function getNamingStrategy() : ?NamingStrategy
588
    {
589
        return $this->namingStrategy
590
            ?? $this->namingStrategy = new DefaultNamingStrategy();
591 1
    }
592
593 1
    /**
594
     * Set the entity listener resolver.
595 1
     *
596 1
     * @since 2.4
597
     */
598 1
    public function setEntityListenerResolver(EntityListenerResolver $resolver) : void
599
    {
600
        $this->entityListenerResolver = $resolver;
601
    }
602
603
    /**
604
     * Get the entity listener resolver.
605
     *
606
     * @since 2.4
607 3
     */
608
    public function getEntityListenerResolver() : EntityListenerResolver
609 3
    {
610 3
        return $this->entityListenerResolver
611 3
            ?? $this->entityListenerResolver = new DefaultEntityListenerResolver();
612
    }
613
614
    /**
615
     * Set the entity repository factory.
616
     *
617
     * @since 2.4
618
     */
619
    public function setRepositoryFactory(RepositoryFactory $repositoryFactory) : void
620
    {
621
        $this->repositoryFactory = $repositoryFactory;
622 3
    }
623
624 3
    /**
625 3
     * Get the entity repository factory.
626
     *
627
     * @since 2.4
628
     */
629
    public function getRepositoryFactory() : RepositoryFactory
630
    {
631
        return $this->repositoryFactory
632
            ?? $this->repositoryFactory = new DefaultRepositoryFactory();
633
    }
634 1
635
    /**
636 1
     * @since 2.5
637 1
     */
638
    public function isSecondLevelCacheEnabled() : bool
639
    {
640
        return $this->isSecondLevelCacheEnabled;
641
    }
642 2291
643
    /**
644 2291
     * @since 2.5
645 2291
     */
646
    public function setSecondLevelCacheEnabled(bool $flag = true) : void
647
    {
648 2291
        $this->isSecondLevelCacheEnabled = $flag;
649
    }
650
651
    /**
652
     * @since 2.5
653
     */
654
    public function setSecondLevelCacheConfiguration(CacheConfiguration $cacheConfig) : void
655
    {
656
        $this->secondLevelCacheConfiguration = $cacheConfig;
657 46
    }
658
659 46
    /**
660 46
     * @since 2.5
661
     *
662
     * @return  \Doctrine\ORM\Cache\CacheConfiguration|null
663
     */
664
    public function getSecondLevelCacheConfiguration() : ?CacheConfiguration
665
    {
666
        if ($this->isSecondLevelCacheEnabled && ! $this->secondLevelCacheConfiguration) {
667
            $this->secondLevelCacheConfiguration = new CacheConfiguration();
668
        }
669
670 45
        return $this->secondLevelCacheConfiguration;
671
    }
672 45
673 45
    /**
674 45
     * Returns query hints, which will be applied to every query in application
675
     *
676
     * @since 2.5
677
     */
678
    public function getDefaultQueryHints() : array
679
    {
680
        return $this->defaultQueryHints;
681
    }
682
683
    /**
684
     * Sets array of query hints, which will be applied to every query in application
685
     *
686
     * @since 2.5
687
     */
688 3
    public function setDefaultQueryHints(array $defaultQueryHints) : void
689
    {
690 3
        $this->defaultQueryHints = $defaultQueryHints;
691
    }
692 3
693 1
    /**
694
     * Gets the value of a default query hint. If the hint name is not recognized, FALSE is returned.
695
     *
696 2
     * @since 2.5
697 2
     *
698
     * @return mixed The value of the hint or FALSE, if the hint name is not recognized.
699
     */
700
    public function getDefaultQueryHint(string $hintName)
701
    {
702
        return $this->defaultQueryHints[$hintName] ?? false;
703
    }
704
705
    /**
706 139
     * Sets a default query hint. If the hint name is not recognized, it is silently ignored.
707
     *
708 139
     * @since 2.5
709 2
     *
710 139
     * @param mixed  $value The value of the hint.
711
     */
712
    public function setDefaultQueryHint(string $hintName, $value) : void
713
    {
714
        $this->defaultQueryHints[$hintName] = $value;
715
    }
716
717
    public function buildGhostObjectFactory() : LazyLoadingGhostFactory
718
    {
719
        return new LazyLoadingGhostFactory(clone $this->getProxyManagerConfiguration());
720
    }
721
722 5
    public function getProxyManagerConfiguration() : ProxyManagerConfiguration
723
    {
724 5
        return $this->proxyManagerConfiguration
725 5
            ?? $this->proxyManagerConfiguration = new ProxyManagerConfiguration();
726
    }
727
}
728