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