@@ 341-358 (lines=18) @@ | ||
338 | $discriminatorColumn = new Mapping\DiscriminatorColumnMetadata(); |
|
339 | ||
340 | // Evaluate @DiscriminatorColumn annotation |
|
341 | if (isset($classAnnotations[Annotation\DiscriminatorColumn::class])) { |
|
342 | /** @var Annotation\DiscriminatorColumn $discriminatorColumnAnnot */ |
|
343 | $discriminatorColumnAnnot = $classAnnotations[Annotation\DiscriminatorColumn::class]; |
|
344 | ||
345 | $discriminatorColumn->setColumnName($discriminatorColumnAnnot->name); |
|
346 | ||
347 | if (! empty($discriminatorColumnAnnot->columnDefinition)) { |
|
348 | $discriminatorColumn->setColumnDefinition($discriminatorColumnAnnot->columnDefinition); |
|
349 | } |
|
350 | ||
351 | if (! empty($discriminatorColumnAnnot->type)) { |
|
352 | $discriminatorColumn->setType(Type::getType($discriminatorColumnAnnot->type)); |
|
353 | } |
|
354 | ||
355 | if (! empty($discriminatorColumnAnnot->length)) { |
|
356 | $discriminatorColumn->setLength($discriminatorColumnAnnot->length); |
|
357 | } |
|
358 | } |
|
359 | ||
360 | if (empty($discriminatorColumn->getColumnName())) { |
|
361 | throw Mapping\MappingException::nameIsMandatoryForDiscriminatorColumns($reflectionClass->getName()); |
@@ 347-364 (lines=18) @@ | ||
344 | $discriminatorColumn->setLength(255); |
|
345 | ||
346 | // Evaluate DiscriminatorColumn annotation |
|
347 | if (isset($classAnnotations[Annotation\DiscriminatorColumn::class])) { |
|
348 | /** @var Annotation\DiscriminatorColumn $discriminatorColumnAnnotation */ |
|
349 | $discriminatorColumnAnnotation = $classAnnotations[Annotation\DiscriminatorColumn::class]; |
|
350 | $typeName = ! empty($discriminatorColumnAnnotation->type) |
|
351 | ? $discriminatorColumnAnnotation->type |
|
352 | : 'string'; |
|
353 | ||
354 | $discriminatorColumn->setType(Type::getType($typeName)); |
|
355 | $discriminatorColumn->setColumnName($discriminatorColumnAnnotation->name); |
|
356 | ||
357 | if (! empty($discriminatorColumnAnnotation->columnDefinition)) { |
|
358 | $discriminatorColumn->setColumnDefinition($discriminatorColumnAnnotation->columnDefinition); |
|
359 | } |
|
360 | ||
361 | if (! empty($discriminatorColumnAnnotation->length)) { |
|
362 | $discriminatorColumn->setLength($discriminatorColumnAnnotation->length); |
|
363 | } |
|
364 | } |
|
365 | ||
366 | $classMetadata->setDiscriminatorColumn($discriminatorColumn); |
|
367 |