Enable empty prefixes for inlined embeddable
This fixes http://www.doctrine-project.org/jira/browse/DDC-2987 This makes it possible to map a field from an embeddable to a database field with the same name, without any prefix added. Example: - an embeddable object "Id" with a property "id" - per default this would map inline to id_id - supplying null or '' as columnPrefix does not work due to the ! empty() check - with my little change, if columnPrefix : false is supplied in the mapping config this will now map to a db column "id" To build Ids as ValueObjects is a very common approach in DDD, so ihmo this is a must have.
This commit is contained in:
parent
b30b1a5999
commit
fa79de6ea4
1 changed files with 1 additions and 1 deletions
|
@ -3187,7 +3187,7 @@ class ClassMetadataInfo implements ClassMetadata
|
|||
$fieldMapping['originalField'] = $fieldMapping['fieldName'];
|
||||
$fieldMapping['fieldName'] = $property . "." . $fieldMapping['fieldName'];
|
||||
|
||||
$fieldMapping['columnName'] = ! empty($this->embeddedClasses[$property]['columnPrefix'])
|
||||
$fieldMapping['columnName'] = ! empty($this->embeddedClasses[$property]['columnPrefix']) || $this->embeddedClasses[$property]['columnPrefix'] === false
|
||||
? $this->embeddedClasses[$property]['columnPrefix'] . $fieldMapping['columnName']
|
||||
: $this->namingStrategy->embeddedFieldToColumnName($property, $fieldMapping['columnName'], $this->reflClass->name, $embeddable->reflClass->name);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue