1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace DoctrineORMModule\Options; |
6
|
|
|
|
7
|
|
|
use Doctrine\ORM\Mapping\EntityListenerResolver; |
8
|
|
|
use Doctrine\ORM\Mapping\NamingStrategy; |
9
|
|
|
use Doctrine\ORM\Mapping\QuoteStrategy; |
10
|
|
|
use Doctrine\ORM\Repository\RepositoryFactory; |
11
|
|
|
use Laminas\Stdlib\Exception\InvalidArgumentException; |
12
|
|
|
use function get_class; |
13
|
|
|
use function gettype; |
14
|
|
|
use function is_object; |
15
|
|
|
use function is_string; |
16
|
|
|
use function sprintf; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Configuration options for an ORM Configuration |
20
|
|
|
*/ |
21
|
|
|
class Configuration extends DBALConfiguration |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* Set the cache key for the metadata cache. Cache key |
25
|
|
|
* is assembled as "doctrine.cache.{key}" and pulled from |
26
|
|
|
* service locator. |
27
|
|
|
* |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
protected $metadataCache = 'array'; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Set the cache key for the query cache. Cache key |
34
|
|
|
* is assembled as "doctrine.cache.{key}" and pulled from |
35
|
|
|
* service locator. |
36
|
|
|
* |
37
|
|
|
* @var string |
38
|
|
|
*/ |
39
|
|
|
protected $queryCache = 'array'; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Set the cache key for the result cache. Cache key |
43
|
|
|
* is assembled as "doctrine.cache.{key}" and pulled from |
44
|
|
|
* service locator. |
45
|
|
|
* |
46
|
|
|
* @var string |
47
|
|
|
*/ |
48
|
|
|
protected $resultCache = 'array'; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Set the cache key for the hydration cache. Cache key |
52
|
|
|
* is assembled as "doctrine.cache.{key}" and pulled from |
53
|
|
|
* service locator. |
54
|
|
|
* |
55
|
|
|
* @var string |
56
|
|
|
*/ |
57
|
|
|
protected $hydrationCache = 'array'; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Set the driver key for the metadata driver. Driver key |
61
|
|
|
* is assembled as "doctrine.driver.{key}" and pulled from |
62
|
|
|
* service locator. |
63
|
|
|
* |
64
|
|
|
* @var string |
65
|
|
|
*/ |
66
|
|
|
protected $driver = 'orm_default'; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Automatic generation of proxies (disable for production!) |
70
|
|
|
* |
71
|
|
|
* @var bool |
72
|
|
|
*/ |
73
|
|
|
protected $generateProxies = true; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Proxy directory. |
77
|
|
|
* |
78
|
|
|
* @var string |
79
|
|
|
*/ |
80
|
|
|
protected $proxyDir = 'data'; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Proxy namespace. |
84
|
|
|
* |
85
|
|
|
* @var string |
86
|
|
|
*/ |
87
|
|
|
protected $proxyNamespace = 'DoctrineORMModule\Proxy'; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Entity alias map. |
91
|
|
|
* |
92
|
|
|
* @var mixed[] |
93
|
|
|
*/ |
94
|
|
|
protected $entityNamespaces = []; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Keys must be function names and values the FQCN of the implementing class. |
98
|
|
|
* The function names will be case-insensitive in DQL. |
99
|
|
|
* |
100
|
|
|
* @var mixed[] |
101
|
|
|
*/ |
102
|
|
|
protected $datetimeFunctions = []; |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Keys must be function names and values the FQCN of the implementing class. |
106
|
|
|
* The function names will be case-insensitive in DQL. |
107
|
|
|
* |
108
|
|
|
* @var mixed[] |
109
|
|
|
*/ |
110
|
|
|
protected $stringFunctions = []; |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Keys must be function names and values the FQCN of the implementing class. |
114
|
|
|
* The function names will be case-insensitive in DQL. |
115
|
|
|
* |
116
|
|
|
* @var mixed[] |
117
|
|
|
*/ |
118
|
|
|
protected $numericFunctions = []; |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* Keys must be the name of the custom filter and the value must be |
122
|
|
|
* the class name for the custom filter. |
123
|
|
|
* |
124
|
|
|
* @var mixed[] |
125
|
|
|
*/ |
126
|
|
|
protected $filters = []; |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* Keys must be the name of the query and values the DQL query string. |
130
|
|
|
* |
131
|
|
|
* @var mixed[] |
132
|
|
|
*/ |
133
|
|
|
protected $namedQueries = []; |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Keys must be the name of the query and the value is an array containing |
137
|
|
|
* the keys 'sql' for native SQL query string and 'rsm' for the Query\ResultSetMapping. |
138
|
|
|
* |
139
|
|
|
* @var mixed[] |
140
|
|
|
*/ |
141
|
|
|
protected $namedNativeQueries = []; |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* Keys must be the name of the custom hydration method and the value must be |
145
|
|
|
* the class name for the custom hydrator |
146
|
|
|
* |
147
|
|
|
* @var mixed[] |
148
|
|
|
*/ |
149
|
|
|
protected $customHydrationModes = []; |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* Naming strategy or name of the naming strategy service to be set in ORM |
153
|
|
|
* configuration (if any) |
154
|
|
|
* |
155
|
|
|
* @var string|NamingStrategy|null |
156
|
|
|
*/ |
157
|
|
|
protected $namingStrategy; |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* Quote strategy or name of the quote strategy service to be set in ORM |
161
|
|
|
* configuration (if any) |
162
|
|
|
* |
163
|
|
|
* @var string|QuoteStrategy|null |
164
|
|
|
*/ |
165
|
|
|
protected $quoteStrategy; |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* Default repository class |
169
|
|
|
* |
170
|
|
|
* @var string|null |
171
|
|
|
*/ |
172
|
|
|
protected $defaultRepositoryClassName; |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* Repository factory or name of the repository factory service to be set in ORM |
176
|
|
|
* configuration (if any) |
177
|
|
|
* |
178
|
|
|
* @var string|RepositoryFactory|null |
179
|
|
|
*/ |
180
|
|
|
protected $repositoryFactory; |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* Class name of MetaData factory to be set in ORM. |
184
|
|
|
* The entityManager will create a new instance on construction. |
185
|
|
|
* |
186
|
|
|
* @var string |
187
|
|
|
*/ |
188
|
|
|
protected $classMetadataFactoryName; |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* Entity listener resolver or service name of the entity listener resolver |
192
|
|
|
* to be set in ORM configuration (if any) |
193
|
|
|
* |
194
|
|
|
* @link http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html |
195
|
|
|
* |
196
|
|
|
* @var string|EntityListenerResolver|null |
197
|
|
|
*/ |
198
|
|
|
protected $entityListenerResolver; |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* Configuration for second level cache |
202
|
|
|
* |
203
|
|
|
* @link http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/second-level-cache.html |
204
|
|
|
* |
205
|
|
|
* @var SecondLevelCacheConfiguration|null |
206
|
|
|
*/ |
207
|
|
|
protected $secondLevelCache; |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* Configuration option for the filter schema assets expression |
211
|
|
|
* |
212
|
|
|
* @var string|null |
213
|
|
|
*/ |
214
|
|
|
protected $filterSchemaAssetsExpression; |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* @param mixed[] $datetimeFunctions |
218
|
|
|
*/ |
219
|
72 |
|
public function setDatetimeFunctions(array $datetimeFunctions) : self |
220
|
|
|
{ |
221
|
72 |
|
$this->datetimeFunctions = $datetimeFunctions; |
222
|
|
|
|
223
|
72 |
|
return $this; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* @return mixed[] |
228
|
|
|
*/ |
229
|
88 |
|
public function getDatetimeFunctions() : array |
230
|
|
|
{ |
231
|
88 |
|
return $this->datetimeFunctions; |
232
|
|
|
} |
233
|
|
|
|
234
|
72 |
|
public function setDriver(string $driver) : self |
235
|
|
|
{ |
236
|
72 |
|
$this->driver = $driver; |
237
|
|
|
|
238
|
72 |
|
return $this; |
239
|
|
|
} |
240
|
|
|
|
241
|
88 |
|
public function getDriver() : string |
242
|
|
|
{ |
243
|
88 |
|
return 'doctrine.driver.' . $this->driver; |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* @param mixed[] $entityNamespaces |
248
|
|
|
*/ |
249
|
|
|
public function setEntityNamespaces(array $entityNamespaces) : self |
250
|
|
|
{ |
251
|
|
|
$this->entityNamespaces = $entityNamespaces; |
252
|
|
|
|
253
|
|
|
return $this; |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* @return mixed[] |
258
|
|
|
*/ |
259
|
88 |
|
public function getEntityNamespaces() : array |
260
|
|
|
{ |
261
|
88 |
|
return $this->entityNamespaces; |
262
|
|
|
} |
263
|
|
|
|
264
|
72 |
|
public function setGenerateProxies(bool $generateProxies) : self |
265
|
|
|
{ |
266
|
72 |
|
$this->generateProxies = $generateProxies; |
267
|
|
|
|
268
|
72 |
|
return $this; |
269
|
|
|
} |
270
|
|
|
|
271
|
88 |
|
public function getGenerateProxies() : bool |
272
|
|
|
{ |
273
|
88 |
|
return $this->generateProxies; |
274
|
|
|
} |
275
|
|
|
|
276
|
72 |
|
public function setMetadataCache(string $metadataCache) : self |
277
|
|
|
{ |
278
|
72 |
|
$this->metadataCache = $metadataCache; |
279
|
|
|
|
280
|
72 |
|
return $this; |
281
|
|
|
} |
282
|
|
|
|
283
|
88 |
|
public function getMetadataCache() : string |
284
|
|
|
{ |
285
|
88 |
|
return 'doctrine.cache.' . $this->metadataCache; |
286
|
|
|
} |
287
|
|
|
|
288
|
73 |
|
public function setResultCache(string $resultCache) : void |
289
|
|
|
{ |
290
|
73 |
|
$this->resultCache = $resultCache; |
291
|
73 |
|
} |
292
|
|
|
|
293
|
88 |
|
public function getResultCache() : string |
294
|
|
|
{ |
295
|
88 |
|
return 'doctrine.cache.' . $this->resultCache; |
296
|
|
|
} |
297
|
|
|
|
298
|
74 |
|
public function setHydrationCache(string $hydrationCache) : self |
299
|
|
|
{ |
300
|
74 |
|
$this->hydrationCache = $hydrationCache; |
301
|
|
|
|
302
|
74 |
|
return $this; |
303
|
|
|
} |
304
|
|
|
|
305
|
88 |
|
public function getHydrationCache() : string |
306
|
|
|
{ |
307
|
88 |
|
return 'doctrine.cache.' . $this->hydrationCache; |
308
|
|
|
} |
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* @param mixed[] $namedNativeQueries |
312
|
|
|
*/ |
313
|
|
|
public function setNamedNativeQueries(array $namedNativeQueries) : self |
314
|
|
|
{ |
315
|
|
|
$this->namedNativeQueries = $namedNativeQueries; |
316
|
|
|
|
317
|
|
|
return $this; |
318
|
|
|
} |
319
|
|
|
|
320
|
|
|
/** |
321
|
|
|
* @return mixed[] |
322
|
|
|
*/ |
323
|
88 |
|
public function getNamedNativeQueries() : array |
324
|
|
|
{ |
325
|
88 |
|
return $this->namedNativeQueries; |
326
|
|
|
} |
327
|
|
|
|
328
|
|
|
/** |
329
|
|
|
* @param mixed[] $namedQueries |
330
|
|
|
*/ |
331
|
|
|
public function setNamedQueries(array $namedQueries) : self |
332
|
|
|
{ |
333
|
|
|
$this->namedQueries = $namedQueries; |
334
|
|
|
|
335
|
|
|
return $this; |
336
|
|
|
} |
337
|
|
|
|
338
|
|
|
/** |
339
|
|
|
* @return mixed[] |
340
|
|
|
*/ |
341
|
88 |
|
public function getNamedQueries() : array |
342
|
|
|
{ |
343
|
88 |
|
return $this->namedQueries; |
344
|
|
|
} |
345
|
|
|
|
346
|
|
|
/** |
347
|
|
|
* @param mixed[] $numericFunctions |
348
|
|
|
*/ |
349
|
72 |
|
public function setNumericFunctions(array $numericFunctions) : self |
350
|
|
|
{ |
351
|
72 |
|
$this->numericFunctions = $numericFunctions; |
352
|
|
|
|
353
|
72 |
|
return $this; |
354
|
|
|
} |
355
|
|
|
|
356
|
|
|
/** |
357
|
|
|
* @return mixed[] |
358
|
|
|
*/ |
359
|
88 |
|
public function getNumericFunctions() : array |
360
|
|
|
{ |
361
|
88 |
|
return $this->numericFunctions; |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
/** |
365
|
|
|
* @param mixed[] $filters |
366
|
|
|
*/ |
367
|
72 |
|
public function setFilters(array $filters) : self |
368
|
|
|
{ |
369
|
72 |
|
$this->filters = $filters; |
370
|
|
|
|
371
|
72 |
|
return $this; |
372
|
|
|
} |
373
|
|
|
|
374
|
|
|
/** |
375
|
|
|
* @return mixed[] |
376
|
|
|
*/ |
377
|
88 |
|
public function getFilters() : array |
378
|
|
|
{ |
379
|
88 |
|
return $this->filters; |
380
|
|
|
} |
381
|
|
|
|
382
|
72 |
|
public function setProxyDir(string $proxyDir) : self |
383
|
|
|
{ |
384
|
72 |
|
$this->proxyDir = $proxyDir; |
385
|
|
|
|
386
|
72 |
|
return $this; |
387
|
|
|
} |
388
|
|
|
|
389
|
88 |
|
public function getProxyDir() : string |
390
|
|
|
{ |
391
|
88 |
|
return $this->proxyDir; |
392
|
|
|
} |
393
|
|
|
|
394
|
72 |
|
public function setProxyNamespace(string $proxyNamespace) : self |
395
|
|
|
{ |
396
|
72 |
|
$this->proxyNamespace = $proxyNamespace; |
397
|
|
|
|
398
|
72 |
|
return $this; |
399
|
|
|
} |
400
|
|
|
|
401
|
88 |
|
public function getProxyNamespace() : string |
402
|
|
|
{ |
403
|
88 |
|
return $this->proxyNamespace; |
404
|
|
|
} |
405
|
|
|
|
406
|
72 |
|
public function setQueryCache(string $queryCache) : self |
407
|
|
|
{ |
408
|
72 |
|
$this->queryCache = $queryCache; |
409
|
|
|
|
410
|
72 |
|
return $this; |
411
|
|
|
} |
412
|
|
|
|
413
|
88 |
|
public function getQueryCache() : string |
414
|
|
|
{ |
415
|
88 |
|
return 'doctrine.cache.' . $this->queryCache; |
416
|
|
|
} |
417
|
|
|
|
418
|
|
|
/** |
419
|
|
|
* @param mixed[] $stringFunctions |
420
|
|
|
*/ |
421
|
72 |
|
public function setStringFunctions(array $stringFunctions) : self |
422
|
|
|
{ |
423
|
72 |
|
$this->stringFunctions = $stringFunctions; |
424
|
|
|
|
425
|
72 |
|
return $this; |
426
|
|
|
} |
427
|
|
|
|
428
|
|
|
/** |
429
|
|
|
* @return mixed[] |
430
|
|
|
*/ |
431
|
88 |
|
public function getStringFunctions() : array |
432
|
|
|
{ |
433
|
88 |
|
return $this->stringFunctions; |
434
|
|
|
} |
435
|
|
|
|
436
|
|
|
/** |
437
|
|
|
* @param mixed[] $modes |
438
|
|
|
*/ |
439
|
|
|
public function setCustomHydrationModes(array $modes) : self |
440
|
|
|
{ |
441
|
|
|
$this->customHydrationModes = $modes; |
442
|
|
|
|
443
|
|
|
return $this; |
444
|
|
|
} |
445
|
|
|
|
446
|
|
|
/** |
447
|
|
|
* @return mixed[] |
448
|
|
|
*/ |
449
|
88 |
|
public function getCustomHydrationModes() : array |
450
|
|
|
{ |
451
|
88 |
|
return $this->customHydrationModes; |
452
|
|
|
} |
453
|
|
|
|
454
|
|
|
/** |
455
|
|
|
* @param string|NamingStrategy|null $namingStrategy |
456
|
|
|
* |
457
|
|
|
* @throws InvalidArgumentException when the provided naming strategy does not fit the expected type. |
458
|
|
|
*/ |
459
|
4 |
|
public function setNamingStrategy($namingStrategy) : self |
460
|
|
|
{ |
461
|
4 |
|
if ($namingStrategy === null |
462
|
4 |
|
|| is_string($namingStrategy) |
463
|
4 |
|
|| $namingStrategy instanceof NamingStrategy |
464
|
|
|
) { |
465
|
4 |
|
$this->namingStrategy = $namingStrategy; |
466
|
|
|
|
467
|
4 |
|
return $this; |
468
|
|
|
} |
469
|
|
|
|
470
|
1 |
|
throw new InvalidArgumentException( |
471
|
1 |
|
sprintf( |
472
|
|
|
'namingStrategy must be either a string, a Doctrine\ORM\Mapping\NamingStrategy ' |
473
|
1 |
|
. 'instance or null, %s given', |
474
|
1 |
|
is_object($namingStrategy) ? get_class($namingStrategy) : gettype($namingStrategy) |
475
|
|
|
) |
476
|
|
|
); |
477
|
|
|
} |
478
|
|
|
|
479
|
|
|
/** |
480
|
|
|
* @return string|NamingStrategy|null |
481
|
|
|
*/ |
482
|
89 |
|
public function getNamingStrategy() |
483
|
|
|
{ |
484
|
89 |
|
return $this->namingStrategy; |
485
|
|
|
} |
486
|
|
|
|
487
|
|
|
/** |
488
|
|
|
* @param string|QuoteStrategy|null $quoteStrategy |
489
|
|
|
* |
490
|
|
|
* @throws InvalidArgumentException when the provided quote strategy does not fit the expected type. |
491
|
|
|
*/ |
492
|
4 |
|
public function setQuoteStrategy($quoteStrategy) : self |
493
|
|
|
{ |
494
|
4 |
|
if ($quoteStrategy === null |
495
|
4 |
|
|| is_string($quoteStrategy) |
496
|
4 |
|
|| $quoteStrategy instanceof QuoteStrategy |
497
|
|
|
) { |
498
|
4 |
|
$this->quoteStrategy = $quoteStrategy; |
499
|
|
|
|
500
|
4 |
|
return $this; |
501
|
|
|
} |
502
|
|
|
|
503
|
1 |
|
throw new InvalidArgumentException( |
504
|
1 |
|
sprintf( |
505
|
|
|
'quoteStrategy must be either a string, a Doctrine\ORM\Mapping\QuoteStrategy ' |
506
|
1 |
|
. 'instance or null, %s given', |
507
|
1 |
|
is_object($quoteStrategy) ? get_class($quoteStrategy) : gettype($quoteStrategy) |
508
|
|
|
) |
509
|
|
|
); |
510
|
|
|
} |
511
|
|
|
|
512
|
|
|
/** |
513
|
|
|
* @return string|QuoteStrategy|null |
514
|
|
|
*/ |
515
|
88 |
|
public function getQuoteStrategy() |
516
|
|
|
{ |
517
|
88 |
|
return $this->quoteStrategy; |
518
|
|
|
} |
519
|
|
|
|
520
|
|
|
/** |
521
|
|
|
* @param string|RepositoryFactory|null $repositoryFactory |
522
|
|
|
* |
523
|
|
|
* @throws InvalidArgumentException when the provided repository factory does not fit the expected type. |
524
|
|
|
*/ |
525
|
1 |
|
public function setRepositoryFactory($repositoryFactory) : self |
526
|
|
|
{ |
527
|
1 |
|
if ($repositoryFactory === null |
528
|
1 |
|
|| is_string($repositoryFactory) |
529
|
1 |
|
|| $repositoryFactory instanceof RepositoryFactory |
530
|
|
|
) { |
531
|
1 |
|
$this->repositoryFactory = $repositoryFactory; |
532
|
|
|
|
533
|
1 |
|
return $this; |
534
|
|
|
} |
535
|
|
|
|
536
|
1 |
|
throw new InvalidArgumentException( |
537
|
1 |
|
sprintf( |
538
|
|
|
'repositoryFactory must be either a string, a Doctrine\ORM\Repository\RepositoryFactory ' |
539
|
1 |
|
. 'instance or null, %s given', |
540
|
1 |
|
is_object($repositoryFactory) ? get_class($repositoryFactory) : gettype($repositoryFactory) |
541
|
|
|
) |
542
|
|
|
); |
543
|
|
|
} |
544
|
|
|
|
545
|
|
|
/** |
546
|
|
|
* @return string|RepositoryFactory|null |
547
|
|
|
*/ |
548
|
87 |
|
public function getRepositoryFactory() |
549
|
|
|
{ |
550
|
87 |
|
return $this->repositoryFactory; |
551
|
|
|
} |
552
|
|
|
|
553
|
|
|
/** |
554
|
|
|
* Set the metadata factory class name to use |
555
|
|
|
* |
556
|
|
|
* @see \Doctrine\ORM\Configuration::setClassMetadataFactoryName() |
557
|
|
|
*/ |
558
|
1 |
|
public function setClassMetadataFactoryName(string $factoryName) : self |
559
|
|
|
{ |
560
|
1 |
|
$this->classMetadataFactoryName = (string) $factoryName; |
561
|
|
|
|
562
|
1 |
|
return $this; |
563
|
|
|
} |
564
|
|
|
|
565
|
88 |
|
public function getClassMetadataFactoryName() : ?string |
566
|
|
|
{ |
567
|
88 |
|
return $this->classMetadataFactoryName; |
568
|
|
|
} |
569
|
|
|
|
570
|
|
|
/** |
571
|
|
|
* @param string|EntityListenerResolver|null $entityListenerResolver |
572
|
|
|
* |
573
|
|
|
* @throws InvalidArgumentException When the provided entity listener resolver |
574
|
|
|
* does not fit the expected type. |
575
|
|
|
*/ |
576
|
3 |
|
public function setEntityListenerResolver($entityListenerResolver) : self |
577
|
|
|
{ |
578
|
3 |
|
if ($entityListenerResolver === null |
579
|
3 |
|
|| $entityListenerResolver instanceof EntityListenerResolver |
580
|
3 |
|
|| is_string($entityListenerResolver) |
581
|
|
|
) { |
582
|
3 |
|
$this->entityListenerResolver = $entityListenerResolver; |
583
|
|
|
|
584
|
3 |
|
return $this; |
585
|
|
|
} |
586
|
|
|
|
587
|
1 |
|
throw new InvalidArgumentException(sprintf( |
588
|
|
|
'entityListenerResolver must be either a string, a Doctrine\ORM\Mapping\EntityListenerResolver ' |
589
|
1 |
|
. 'instance or null, %s given', |
590
|
1 |
|
is_object($entityListenerResolver) ? get_class($entityListenerResolver) : gettype($entityListenerResolver) |
591
|
|
|
)); |
592
|
|
|
} |
593
|
|
|
|
594
|
|
|
/** |
595
|
|
|
* @return string|EntityListenerResolver|null |
596
|
|
|
*/ |
597
|
87 |
|
public function getEntityListenerResolver() |
598
|
|
|
{ |
599
|
87 |
|
return $this->entityListenerResolver; |
600
|
|
|
} |
601
|
|
|
|
602
|
|
|
/** |
603
|
|
|
* @param mixed[] $secondLevelCache |
604
|
|
|
*/ |
605
|
73 |
|
public function setSecondLevelCache(array $secondLevelCache) : self |
606
|
|
|
{ |
607
|
73 |
|
$this->secondLevelCache = new SecondLevelCacheConfiguration($secondLevelCache); |
608
|
|
|
|
609
|
73 |
|
return $this; |
610
|
|
|
} |
611
|
|
|
|
612
|
86 |
|
public function getSecondLevelCache() : SecondLevelCacheConfiguration |
613
|
|
|
{ |
614
|
86 |
|
return $this->secondLevelCache ?: new SecondLevelCacheConfiguration(); |
615
|
|
|
} |
616
|
|
|
|
617
|
|
|
public function setFilterSchemaAssetsExpression(string $filterSchemaAssetsExpression) : self |
618
|
|
|
{ |
619
|
|
|
$this->filterSchemaAssetsExpression = $filterSchemaAssetsExpression; |
620
|
|
|
|
621
|
|
|
return $this; |
622
|
|
|
} |
623
|
|
|
|
624
|
86 |
|
public function getFilterSchemaAssetsExpression() : ?string |
625
|
|
|
{ |
626
|
86 |
|
return $this->filterSchemaAssetsExpression; |
627
|
|
|
} |
628
|
|
|
|
629
|
|
|
/** |
630
|
|
|
* Sets default repository class. |
631
|
|
|
*/ |
632
|
73 |
|
public function setDefaultRepositoryClassName(string $className) : self |
633
|
|
|
{ |
634
|
73 |
|
$this->defaultRepositoryClassName = (string) $className; |
635
|
|
|
|
636
|
73 |
|
return $this; |
637
|
|
|
} |
638
|
|
|
|
639
|
|
|
/** |
640
|
|
|
* Get default repository class name. |
641
|
|
|
*/ |
642
|
86 |
|
public function getDefaultRepositoryClassName() : ?string |
643
|
|
|
{ |
644
|
86 |
|
return $this->defaultRepositoryClassName; |
645
|
|
|
} |
646
|
|
|
} |
647
|
|
|
|