Conditions | 142 |
Paths | > 20000 |
Total Lines | 613 |
Code Lines | 319 |
Lines | 80 |
Ratio | 13.05 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
53 | public function loadMetadataForClass($className, ClassMetadata $metadata) |
||
54 | { |
||
55 | /* @var $metadata \Doctrine\ORM\Mapping\ClassMetadataInfo */ |
||
56 | $element = $this->getElement($className); |
||
57 | |||
58 | if ($element['type'] == 'entity') { |
||
59 | if (isset($element['repositoryClass'])) { |
||
60 | $metadata->setCustomRepositoryClass($element['repositoryClass']); |
||
61 | } |
||
62 | if (isset($element['readOnly']) && $element['readOnly'] == true) { |
||
63 | $metadata->markReadOnly(); |
||
64 | } |
||
65 | } else if ($element['type'] == 'mappedSuperclass') { |
||
66 | $metadata->setCustomRepositoryClass( |
||
67 | $element['repositoryClass'] ?? null |
||
68 | ); |
||
69 | $metadata->isMappedSuperclass = true; |
||
70 | } else if ($element['type'] == 'embeddable') { |
||
71 | $metadata->isEmbeddedClass = true; |
||
72 | } else { |
||
73 | throw MappingException::classIsNotAValidEntityOrMappedSuperClass($className); |
||
74 | } |
||
75 | |||
76 | // Evaluate root level properties |
||
77 | $primaryTable = []; |
||
78 | |||
79 | if (isset($element['table'])) { |
||
80 | $primaryTable['name'] = $element['table']; |
||
81 | } |
||
82 | |||
83 | if (isset($element['schema'])) { |
||
84 | $primaryTable['schema'] = $element['schema']; |
||
85 | } |
||
86 | |||
87 | // Evaluate second level cache |
||
88 | if (isset($element['cache'])) { |
||
89 | $metadata->enableCache($this->cacheToArray($element['cache'])); |
||
90 | } |
||
91 | |||
92 | $metadata->setPrimaryTable($primaryTable); |
||
93 | |||
94 | // Evaluate named queries |
||
95 | if (isset($element['namedQueries'])) { |
||
96 | foreach ($element['namedQueries'] as $name => $queryMapping) { |
||
97 | if (is_string($queryMapping)) { |
||
98 | $queryMapping = ['query' => $queryMapping]; |
||
99 | } |
||
100 | |||
101 | if ( ! isset($queryMapping['name'])) { |
||
102 | $queryMapping['name'] = $name; |
||
103 | } |
||
104 | |||
105 | $metadata->addNamedQuery($queryMapping); |
||
106 | } |
||
107 | } |
||
108 | |||
109 | // Evaluate named native queries |
||
110 | if (isset($element['namedNativeQueries'])) { |
||
111 | foreach ($element['namedNativeQueries'] as $name => $mappingElement) { |
||
112 | if (!isset($mappingElement['name'])) { |
||
113 | $mappingElement['name'] = $name; |
||
114 | } |
||
115 | $metadata->addNamedNativeQuery( |
||
116 | [ |
||
117 | 'name' => $mappingElement['name'], |
||
118 | 'query' => $mappingElement['query'] ?? null, |
||
119 | 'resultClass' => $mappingElement['resultClass'] ?? null, |
||
120 | 'resultSetMapping' => $mappingElement['resultSetMapping'] ?? null, |
||
121 | ] |
||
122 | ); |
||
123 | } |
||
124 | } |
||
125 | |||
126 | // Evaluate sql result set mappings |
||
127 | if (isset($element['sqlResultSetMappings'])) { |
||
128 | foreach ($element['sqlResultSetMappings'] as $name => $resultSetMapping) { |
||
129 | if (!isset($resultSetMapping['name'])) { |
||
130 | $resultSetMapping['name'] = $name; |
||
131 | } |
||
132 | |||
133 | $entities = []; |
||
134 | $columns = []; |
||
135 | if (isset($resultSetMapping['entityResult'])) { |
||
136 | foreach ($resultSetMapping['entityResult'] as $entityResultElement) { |
||
137 | $entityResult = [ |
||
138 | 'fields' => [], |
||
139 | 'entityClass' => $entityResultElement['entityClass'] ?? null, |
||
140 | 'discriminatorColumn' => $entityResultElement['discriminatorColumn'] ?? null, |
||
141 | ]; |
||
142 | |||
143 | if (isset($entityResultElement['fieldResult'])) { |
||
144 | foreach ($entityResultElement['fieldResult'] as $fieldResultElement) { |
||
145 | $entityResult['fields'][] = [ |
||
146 | 'name' => $fieldResultElement['name'] ?? null, |
||
147 | 'column' => $fieldResultElement['column'] ?? null, |
||
148 | ]; |
||
149 | } |
||
150 | } |
||
151 | |||
152 | $entities[] = $entityResult; |
||
153 | } |
||
154 | } |
||
155 | |||
156 | |||
157 | if (isset($resultSetMapping['columnResult'])) { |
||
158 | foreach ($resultSetMapping['columnResult'] as $columnResultAnnot) { |
||
159 | $columns[] = [ |
||
160 | 'name' => $columnResultAnnot['name'] ?? null, |
||
161 | ]; |
||
162 | } |
||
163 | } |
||
164 | |||
165 | $metadata->addSqlResultSetMapping( |
||
166 | [ |
||
167 | 'name' => $resultSetMapping['name'], |
||
168 | 'entities' => $entities, |
||
169 | 'columns' => $columns |
||
170 | ] |
||
171 | ); |
||
172 | } |
||
173 | } |
||
174 | |||
175 | if (isset($element['inheritanceType'])) { |
||
176 | $metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . strtoupper($element['inheritanceType']))); |
||
177 | |||
178 | if ($metadata->inheritanceType != Metadata::INHERITANCE_TYPE_NONE) { |
||
179 | // Evaluate discriminatorColumn |
||
180 | if (isset($element['discriminatorColumn'])) { |
||
181 | $discrColumn = $element['discriminatorColumn']; |
||
182 | $metadata->setDiscriminatorColumn( |
||
183 | [ |
||
184 | 'name' => isset($discrColumn['name']) ? (string) $discrColumn['name'] : null, |
||
185 | 'type' => (string) ($discrColumn['type'] ?? 'string'), |
||
186 | 'length' => isset($discrColumn['length']) ? (string) $discrColumn['length'] : 255, |
||
187 | 'columnDefinition' => isset($discrColumn['columnDefinition']) ? (string) $discrColumn['columnDefinition'] : null |
||
188 | ] |
||
189 | ); |
||
190 | } else { |
||
191 | $metadata->setDiscriminatorColumn(['name' => 'dtype', 'type' => 'string', 'length' => 255]); |
||
192 | } |
||
193 | |||
194 | // Evaluate discriminatorMap |
||
195 | if (isset($element['discriminatorMap'])) { |
||
196 | $metadata->setDiscriminatorMap($element['discriminatorMap']); |
||
197 | } |
||
198 | } |
||
199 | } |
||
200 | |||
201 | |||
202 | // Evaluate changeTrackingPolicy |
||
203 | if (isset($element['changeTrackingPolicy'])) { |
||
204 | $metadata->setChangeTrackingPolicy(constant('Doctrine\ORM\Mapping\ClassMetadata::CHANGETRACKING_' |
||
205 | . strtoupper($element['changeTrackingPolicy']))); |
||
206 | } |
||
207 | |||
208 | // Evaluate indexes |
||
209 | if (isset($element['indexes'])) { |
||
210 | foreach ($element['indexes'] as $name => $indexYml) { |
||
211 | if ( ! isset($indexYml['name'])) { |
||
212 | $indexYml['name'] = $name; |
||
213 | } |
||
214 | |||
215 | View Code Duplication | if (is_string($indexYml['columns'])) { |
|
216 | $index = ['columns' => array_map('trim', explode(',', $indexYml['columns']))]; |
||
217 | } else { |
||
218 | $index = ['columns' => $indexYml['columns']]; |
||
219 | } |
||
220 | |||
221 | if (isset($indexYml['flags'])) { |
||
222 | if (is_string($indexYml['flags'])) { |
||
223 | $index['flags'] = array_map('trim', explode(',', $indexYml['flags'])); |
||
224 | } else { |
||
225 | $index['flags'] = $indexYml['flags']; |
||
226 | } |
||
227 | } |
||
228 | |||
229 | if (isset($indexYml['options'])) { |
||
230 | $index['options'] = $indexYml['options']; |
||
231 | } |
||
232 | |||
233 | $metadata->table['indexes'][$indexYml['name']] = $index; |
||
234 | } |
||
235 | } |
||
236 | |||
237 | // Evaluate uniqueConstraints |
||
238 | if (isset($element['uniqueConstraints'])) { |
||
239 | foreach ($element['uniqueConstraints'] as $name => $uniqueYml) { |
||
240 | if ( ! isset($uniqueYml['name'])) { |
||
241 | $uniqueYml['name'] = $name; |
||
242 | } |
||
243 | |||
244 | View Code Duplication | if (is_string($uniqueYml['columns'])) { |
|
245 | $unique = ['columns' => array_map('trim', explode(',', $uniqueYml['columns']))]; |
||
246 | } else { |
||
247 | $unique = ['columns' => $uniqueYml['columns']]; |
||
248 | } |
||
249 | |||
250 | if (isset($uniqueYml['options'])) { |
||
251 | $unique['options'] = $uniqueYml['options']; |
||
252 | } |
||
253 | |||
254 | $metadata->table['uniqueConstraints'][$uniqueYml['name']] = $unique; |
||
255 | } |
||
256 | } |
||
257 | |||
258 | if (isset($element['options'])) { |
||
259 | $metadata->table['options'] = $element['options']; |
||
260 | } |
||
261 | |||
262 | $associationIds = []; |
||
263 | if (isset($element['id'])) { |
||
264 | // Evaluate identifier settings |
||
265 | foreach ($element['id'] as $name => $idElement) { |
||
266 | if (isset($idElement['associationKey']) && $idElement['associationKey'] == true) { |
||
267 | $associationIds[$name] = true; |
||
268 | continue; |
||
269 | } |
||
270 | |||
271 | $mapping = [ |
||
272 | 'id' => true, |
||
273 | 'fieldName' => $name |
||
274 | ]; |
||
275 | |||
276 | if (isset($idElement['type'])) { |
||
277 | $mapping['type'] = $idElement['type']; |
||
278 | } |
||
279 | |||
280 | if (isset($idElement['column'])) { |
||
281 | $mapping['columnName'] = $idElement['column']; |
||
282 | } |
||
283 | |||
284 | if (isset($idElement['length'])) { |
||
285 | $mapping['length'] = $idElement['length']; |
||
286 | } |
||
287 | |||
288 | if (isset($idElement['columnDefinition'])) { |
||
289 | $mapping['columnDefinition'] = $idElement['columnDefinition']; |
||
290 | } |
||
291 | |||
292 | if (isset($idElement['options'])) { |
||
293 | $mapping['options'] = $idElement['options']; |
||
294 | } |
||
295 | |||
296 | $metadata->mapField($mapping); |
||
297 | |||
298 | View Code Duplication | if (isset($idElement['generator'])) { |
|
299 | $metadata->setIdGeneratorType(constant('Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_' |
||
300 | . strtoupper($idElement['generator']['strategy']))); |
||
301 | } |
||
302 | // Check for SequenceGenerator/TableGenerator definition |
||
303 | if (isset($idElement['sequenceGenerator'])) { |
||
304 | $metadata->setSequenceGeneratorDefinition($idElement['sequenceGenerator']); |
||
305 | } else if (isset($idElement['customIdGenerator'])) { |
||
306 | $customGenerator = $idElement['customIdGenerator']; |
||
307 | $metadata->setCustomGeneratorDefinition( |
||
308 | [ |
||
309 | 'class' => (string) $customGenerator['class'] |
||
310 | ] |
||
311 | ); |
||
312 | } else if (isset($idElement['tableGenerator'])) { |
||
313 | throw MappingException::tableIdGeneratorNotImplemented($className); |
||
314 | } |
||
315 | } |
||
316 | } |
||
317 | |||
318 | // Evaluate fields |
||
319 | if (isset($element['fields'])) { |
||
320 | foreach ($element['fields'] as $name => $fieldMapping) { |
||
321 | |||
322 | $mapping = $this->columnToArray($name, $fieldMapping); |
||
323 | |||
324 | if (isset($fieldMapping['id'])) { |
||
325 | $mapping['id'] = true; |
||
326 | View Code Duplication | if (isset($fieldMapping['generator']['strategy'])) { |
|
327 | $metadata->setIdGeneratorType(constant('Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_' |
||
328 | . strtoupper($fieldMapping['generator']['strategy']))); |
||
329 | } |
||
330 | } |
||
331 | |||
332 | if (isset($mapping['version'])) { |
||
333 | $metadata->setVersionMapping($mapping); |
||
334 | unset($mapping['version']); |
||
335 | } |
||
336 | |||
337 | $metadata->mapField($mapping); |
||
338 | } |
||
339 | } |
||
340 | |||
341 | if (isset($element['embedded'])) { |
||
342 | foreach ($element['embedded'] as $name => $embeddedMapping) { |
||
343 | $mapping = [ |
||
344 | 'fieldName' => $name, |
||
345 | 'class' => $embeddedMapping['class'], |
||
346 | 'columnPrefix' => $embeddedMapping['columnPrefix'] ?? null, |
||
347 | ]; |
||
348 | $metadata->mapEmbedded($mapping); |
||
349 | } |
||
350 | } |
||
351 | |||
352 | // Evaluate oneToOne relationships |
||
353 | if (isset($element['oneToOne'])) { |
||
354 | foreach ($element['oneToOne'] as $name => $oneToOneElement) { |
||
355 | $mapping = [ |
||
356 | 'fieldName' => $name, |
||
357 | 'targetEntity' => $oneToOneElement['targetEntity'] |
||
358 | ]; |
||
359 | |||
360 | if (isset($associationIds[$mapping['fieldName']])) { |
||
361 | $mapping['id'] = true; |
||
362 | } |
||
363 | |||
364 | View Code Duplication | if (isset($oneToOneElement['fetch'])) { |
|
365 | $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $oneToOneElement['fetch']); |
||
366 | } |
||
367 | |||
368 | if (isset($oneToOneElement['mappedBy'])) { |
||
369 | $mapping['mappedBy'] = $oneToOneElement['mappedBy']; |
||
370 | } else { |
||
371 | if (isset($oneToOneElement['inversedBy'])) { |
||
372 | $mapping['inversedBy'] = $oneToOneElement['inversedBy']; |
||
373 | } |
||
374 | |||
375 | $joinColumns = []; |
||
376 | |||
377 | View Code Duplication | if (isset($oneToOneElement['joinColumn'])) { |
|
378 | $joinColumns[] = $this->joinColumnToArray($oneToOneElement['joinColumn']); |
||
379 | } else if (isset($oneToOneElement['joinColumns'])) { |
||
380 | foreach ($oneToOneElement['joinColumns'] as $joinColumnName => $joinColumnElement) { |
||
381 | if ( ! isset($joinColumnElement['name'])) { |
||
382 | $joinColumnElement['name'] = $joinColumnName; |
||
383 | } |
||
384 | |||
385 | $joinColumns[] = $this->joinColumnToArray($joinColumnElement); |
||
386 | } |
||
387 | } |
||
388 | |||
389 | $mapping['joinColumns'] = $joinColumns; |
||
390 | } |
||
391 | |||
392 | if (isset($oneToOneElement['cascade'])) { |
||
393 | $mapping['cascade'] = $oneToOneElement['cascade']; |
||
394 | } |
||
395 | |||
396 | if (isset($oneToOneElement['orphanRemoval'])) { |
||
397 | $mapping['orphanRemoval'] = (bool) $oneToOneElement['orphanRemoval']; |
||
398 | } |
||
399 | |||
400 | // Evaluate second level cache |
||
401 | View Code Duplication | if (isset($oneToOneElement['cache'])) { |
|
402 | $mapping['cache'] = $metadata->getAssociationCacheDefaults($mapping['fieldName'], $this->cacheToArray($oneToOneElement['cache'])); |
||
403 | } |
||
404 | |||
405 | $metadata->mapOneToOne($mapping); |
||
406 | } |
||
407 | } |
||
408 | |||
409 | // Evaluate oneToMany relationships |
||
410 | if (isset($element['oneToMany'])) { |
||
411 | foreach ($element['oneToMany'] as $name => $oneToManyElement) { |
||
412 | $mapping = [ |
||
413 | 'fieldName' => $name, |
||
414 | 'targetEntity' => $oneToManyElement['targetEntity'], |
||
415 | 'mappedBy' => $oneToManyElement['mappedBy'] |
||
416 | ]; |
||
417 | |||
418 | View Code Duplication | if (isset($oneToManyElement['fetch'])) { |
|
419 | $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $oneToManyElement['fetch']); |
||
420 | } |
||
421 | |||
422 | if (isset($oneToManyElement['cascade'])) { |
||
423 | $mapping['cascade'] = $oneToManyElement['cascade']; |
||
424 | } |
||
425 | |||
426 | if (isset($oneToManyElement['orphanRemoval'])) { |
||
427 | $mapping['orphanRemoval'] = (bool) $oneToManyElement['orphanRemoval']; |
||
428 | } |
||
429 | |||
430 | if (isset($oneToManyElement['orderBy'])) { |
||
431 | $mapping['orderBy'] = $oneToManyElement['orderBy']; |
||
432 | } |
||
433 | |||
434 | if (isset($oneToManyElement['indexBy'])) { |
||
435 | $mapping['indexBy'] = $oneToManyElement['indexBy']; |
||
436 | } |
||
437 | |||
438 | |||
439 | // Evaluate second level cache |
||
440 | View Code Duplication | if (isset($oneToManyElement['cache'])) { |
|
441 | $mapping['cache'] = $metadata->getAssociationCacheDefaults($mapping['fieldName'], $this->cacheToArray($oneToManyElement['cache'])); |
||
442 | } |
||
443 | |||
444 | $metadata->mapOneToMany($mapping); |
||
445 | } |
||
446 | } |
||
447 | |||
448 | // Evaluate manyToOne relationships |
||
449 | if (isset($element['manyToOne'])) { |
||
450 | foreach ($element['manyToOne'] as $name => $manyToOneElement) { |
||
451 | $mapping = [ |
||
452 | 'fieldName' => $name, |
||
453 | 'targetEntity' => $manyToOneElement['targetEntity'] |
||
454 | ]; |
||
455 | |||
456 | if (isset($associationIds[$mapping['fieldName']])) { |
||
457 | $mapping['id'] = true; |
||
458 | } |
||
459 | |||
460 | View Code Duplication | if (isset($manyToOneElement['fetch'])) { |
|
461 | $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $manyToOneElement['fetch']); |
||
462 | } |
||
463 | |||
464 | if (isset($manyToOneElement['inversedBy'])) { |
||
465 | $mapping['inversedBy'] = $manyToOneElement['inversedBy']; |
||
466 | } |
||
467 | |||
468 | $joinColumns = []; |
||
469 | |||
470 | View Code Duplication | if (isset($manyToOneElement['joinColumn'])) { |
|
471 | $joinColumns[] = $this->joinColumnToArray($manyToOneElement['joinColumn']); |
||
472 | } else if (isset($manyToOneElement['joinColumns'])) { |
||
473 | foreach ($manyToOneElement['joinColumns'] as $joinColumnName => $joinColumnElement) { |
||
474 | if ( ! isset($joinColumnElement['name'])) { |
||
475 | $joinColumnElement['name'] = $joinColumnName; |
||
476 | } |
||
477 | |||
478 | $joinColumns[] = $this->joinColumnToArray($joinColumnElement); |
||
479 | } |
||
480 | } |
||
481 | |||
482 | $mapping['joinColumns'] = $joinColumns; |
||
483 | |||
484 | if (isset($manyToOneElement['cascade'])) { |
||
485 | $mapping['cascade'] = $manyToOneElement['cascade']; |
||
486 | } |
||
487 | |||
488 | // Evaluate second level cache |
||
489 | View Code Duplication | if (isset($manyToOneElement['cache'])) { |
|
490 | $mapping['cache'] = $metadata->getAssociationCacheDefaults($mapping['fieldName'], $this->cacheToArray($manyToOneElement['cache'])); |
||
491 | } |
||
492 | |||
493 | $metadata->mapManyToOne($mapping); |
||
494 | } |
||
495 | } |
||
496 | |||
497 | // Evaluate manyToMany relationships |
||
498 | if (isset($element['manyToMany'])) { |
||
499 | foreach ($element['manyToMany'] as $name => $manyToManyElement) { |
||
500 | $mapping = [ |
||
501 | 'fieldName' => $name, |
||
502 | 'targetEntity' => $manyToManyElement['targetEntity'] |
||
503 | ]; |
||
504 | |||
505 | View Code Duplication | if (isset($manyToManyElement['fetch'])) { |
|
506 | $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $manyToManyElement['fetch']); |
||
507 | } |
||
508 | |||
509 | if (isset($manyToManyElement['mappedBy'])) { |
||
510 | $mapping['mappedBy'] = $manyToManyElement['mappedBy']; |
||
511 | } else if (isset($manyToManyElement['joinTable'])) { |
||
512 | |||
513 | $joinTableElement = $manyToManyElement['joinTable']; |
||
514 | $joinTable = [ |
||
515 | 'name' => $joinTableElement['name'] |
||
516 | ]; |
||
517 | |||
518 | if (isset($joinTableElement['schema'])) { |
||
519 | $joinTable['schema'] = $joinTableElement['schema']; |
||
520 | } |
||
521 | |||
522 | View Code Duplication | if (isset($joinTableElement['joinColumns'])) { |
|
523 | foreach ($joinTableElement['joinColumns'] as $joinColumnName => $joinColumnElement) { |
||
524 | if ( ! isset($joinColumnElement['name'])) { |
||
525 | $joinColumnElement['name'] = $joinColumnName; |
||
526 | } |
||
527 | $joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumnElement); |
||
528 | } |
||
529 | } |
||
530 | |||
531 | View Code Duplication | if (isset($joinTableElement['inverseJoinColumns'])) { |
|
532 | foreach ($joinTableElement['inverseJoinColumns'] as $joinColumnName => $joinColumnElement) { |
||
533 | if ( ! isset($joinColumnElement['name'])) { |
||
534 | $joinColumnElement['name'] = $joinColumnName; |
||
535 | } |
||
536 | $joinTable['inverseJoinColumns'][] = $this->joinColumnToArray($joinColumnElement); |
||
537 | } |
||
538 | } |
||
539 | |||
540 | $mapping['joinTable'] = $joinTable; |
||
541 | } |
||
542 | |||
543 | if (isset($manyToManyElement['inversedBy'])) { |
||
544 | $mapping['inversedBy'] = $manyToManyElement['inversedBy']; |
||
545 | } |
||
546 | |||
547 | if (isset($manyToManyElement['cascade'])) { |
||
548 | $mapping['cascade'] = $manyToManyElement['cascade']; |
||
549 | } |
||
550 | |||
551 | if (isset($manyToManyElement['orderBy'])) { |
||
552 | $mapping['orderBy'] = $manyToManyElement['orderBy']; |
||
553 | } |
||
554 | |||
555 | if (isset($manyToManyElement['indexBy'])) { |
||
556 | $mapping['indexBy'] = $manyToManyElement['indexBy']; |
||
557 | } |
||
558 | |||
559 | if (isset($manyToManyElement['orphanRemoval'])) { |
||
560 | $mapping['orphanRemoval'] = (bool) $manyToManyElement['orphanRemoval']; |
||
561 | } |
||
562 | |||
563 | // Evaluate second level cache |
||
564 | View Code Duplication | if (isset($manyToManyElement['cache'])) { |
|
565 | $mapping['cache'] = $metadata->getAssociationCacheDefaults($mapping['fieldName'], $this->cacheToArray($manyToManyElement['cache'])); |
||
566 | } |
||
567 | |||
568 | $metadata->mapManyToMany($mapping); |
||
569 | } |
||
570 | } |
||
571 | |||
572 | // Evaluate associationOverride |
||
573 | if (isset($element['associationOverride']) && is_array($element['associationOverride'])) { |
||
574 | |||
575 | foreach ($element['associationOverride'] as $fieldName => $associationOverrideElement) { |
||
576 | $override = []; |
||
577 | |||
578 | // Check for joinColumn |
||
579 | if (isset($associationOverrideElement['joinColumn'])) { |
||
580 | $joinColumns = []; |
||
581 | foreach ($associationOverrideElement['joinColumn'] as $name => $joinColumnElement) { |
||
582 | if ( ! isset($joinColumnElement['name'])) { |
||
583 | $joinColumnElement['name'] = $name; |
||
584 | } |
||
585 | $joinColumns[] = $this->joinColumnToArray($joinColumnElement); |
||
586 | } |
||
587 | $override['joinColumns'] = $joinColumns; |
||
588 | } |
||
589 | |||
590 | // Check for joinTable |
||
591 | if (isset($associationOverrideElement['joinTable'])) { |
||
592 | |||
593 | $joinTableElement = $associationOverrideElement['joinTable']; |
||
594 | $joinTable = [ |
||
595 | 'name' => $joinTableElement['name'] |
||
596 | ]; |
||
597 | |||
598 | if (isset($joinTableElement['schema'])) { |
||
599 | $joinTable['schema'] = $joinTableElement['schema']; |
||
600 | } |
||
601 | |||
602 | foreach ($joinTableElement['joinColumns'] as $name => $joinColumnElement) { |
||
603 | if ( ! isset($joinColumnElement['name'])) { |
||
604 | $joinColumnElement['name'] = $name; |
||
605 | } |
||
606 | |||
607 | $joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumnElement); |
||
608 | } |
||
609 | |||
610 | foreach ($joinTableElement['inverseJoinColumns'] as $name => $joinColumnElement) { |
||
611 | if ( ! isset($joinColumnElement['name'])) { |
||
612 | $joinColumnElement['name'] = $name; |
||
613 | } |
||
614 | |||
615 | $joinTable['inverseJoinColumns'][] = $this->joinColumnToArray($joinColumnElement); |
||
616 | } |
||
617 | |||
618 | $override['joinTable'] = $joinTable; |
||
619 | } |
||
620 | |||
621 | // Check for inversedBy |
||
622 | if (isset($associationOverrideElement['inversedBy'])) { |
||
623 | $override['inversedBy'] = (string) $associationOverrideElement['inversedBy']; |
||
624 | } |
||
625 | |||
626 | // Check for `fetch` |
||
627 | if (isset($associationOverrideElement['fetch'])) { |
||
628 | $override['fetch'] = constant(Metadata::class . '::FETCH_' . $associationOverrideElement['fetch']); |
||
629 | } |
||
630 | |||
631 | $metadata->setAssociationOverride($fieldName, $override); |
||
632 | } |
||
633 | } |
||
634 | |||
635 | // Evaluate associationOverride |
||
636 | if (isset($element['attributeOverride']) && is_array($element['attributeOverride'])) { |
||
637 | |||
638 | foreach ($element['attributeOverride'] as $fieldName => $attributeOverrideElement) { |
||
639 | $mapping = $this->columnToArray($fieldName, $attributeOverrideElement); |
||
640 | $metadata->setAttributeOverride($fieldName, $mapping); |
||
641 | } |
||
642 | } |
||
643 | |||
644 | // Evaluate lifeCycleCallbacks |
||
645 | if (isset($element['lifecycleCallbacks'])) { |
||
646 | foreach ($element['lifecycleCallbacks'] as $type => $methods) { |
||
647 | foreach ($methods as $method) { |
||
648 | $metadata->addLifecycleCallback($method, constant('Doctrine\ORM\Events::' . $type)); |
||
649 | } |
||
650 | } |
||
651 | } |
||
652 | |||
653 | // Evaluate entityListeners |
||
654 | if (isset($element['entityListeners'])) { |
||
655 | foreach ($element['entityListeners'] as $className => $entityListener) { |
||
656 | // Evaluate the listener using naming convention. |
||
657 | if (empty($entityListener)) { |
||
658 | EntityListenerBuilder::bindEntityListener($metadata, $className); |
||
659 | |||
660 | continue; |
||
661 | } |
||
662 | |||
663 | foreach ($entityListener as $eventName => $callbackElement) { |
||
664 | foreach ($callbackElement as $methodName) { |
||
665 | $metadata->addEntityListener($eventName, $className, $methodName); |
||
666 | } |
||
812 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths