makes column prefix configurable
This commit is contained in:
parent
2b2f4894cb
commit
17e0a7b2f8
@ -3088,7 +3088,8 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
$this->assertFieldNotMapped($mapping['fieldName']);
|
||||
|
||||
$this->embeddedClasses[$mapping['fieldName']] = array(
|
||||
'class' => $this->fullyQualifiedClassName($mapping['class'])
|
||||
'class' => $this->fullyQualifiedClassName($mapping['class']),
|
||||
'columnPrefix' => $mapping['columnPrefix'],
|
||||
);
|
||||
}
|
||||
|
||||
@ -3104,7 +3105,10 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
$fieldMapping['declaredField'] = $property;
|
||||
$fieldMapping['originalField'] = $fieldMapping['fieldName'];
|
||||
$fieldMapping['fieldName'] = $property . "." . $fieldMapping['fieldName'];
|
||||
$fieldMapping['columnName'] = $this->namingStrategy->embeddedFieldToColumnName($property, $fieldMapping['columnName'], $this->reflClass->name, $embeddable->reflClass->name);
|
||||
|
||||
$fieldMapping['columnName'] = ! empty($this->embeddedClasses[$property]['columnPrefix'])
|
||||
? $this->embeddedClasses[$property]['columnPrefix'] . $fieldMapping['columnName']
|
||||
: $this->namingStrategy->embeddedFieldToColumnName($property, $fieldMapping['columnName'], $this->reflClass->name, $embeddable->reflClass->name);
|
||||
|
||||
$this->mapField($fieldMapping);
|
||||
}
|
||||
|
@ -370,6 +370,7 @@ class AnnotationDriver extends AbstractAnnotationDriver
|
||||
$metadata->mapManyToMany($mapping);
|
||||
} else if ($embeddedAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Embedded')) {
|
||||
$mapping['class'] = $embeddedAnnot->class;
|
||||
$mapping['columnPrefix'] = $embeddedAnnot->columnPrefix;
|
||||
$metadata->mapEmbedded($mapping);
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,13 @@ namespace Doctrine\ORM\Mapping;
|
||||
final class Embedded implements Annotation
|
||||
{
|
||||
/**
|
||||
* @Required
|
||||
* @var string
|
||||
*/
|
||||
public $class;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $columnPrefix;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user