make use of NamingStrategy for columns of embedded fields
This commit is contained in:
parent
fd8b5bd045
commit
20fb8270dc
@ -1,3 +1,11 @@
|
||||
# Upgrade to 2.5
|
||||
|
||||
## BC BREAK: NamingStrategy has a new method ``embeddedFieldToColumnName($propertyName, $embeddedColumnName)``
|
||||
|
||||
This method generates the column name for fields of embedded objects. If you implement your custom NamingStrategy, you
|
||||
now also need to implement this new method.
|
||||
|
||||
|
||||
# Upgrade to 2.4
|
||||
|
||||
## BC BREAK: Compatibility Bugfix in PersistentCollection#matching()
|
||||
|
@ -3094,7 +3094,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
$fieldMapping['declaredField'] = $property;
|
||||
$fieldMapping['originalField'] = $fieldMapping['fieldName'];
|
||||
$fieldMapping['fieldName'] = $property . "." . $fieldMapping['fieldName'];
|
||||
$fieldMapping['columnName'] = $property . "_" . $fieldMapping['columnName'];
|
||||
$fieldMapping['columnName'] = $this->namingStrategy->embeddedFieldToColumnName($property, $fieldMapping['columnName']);
|
||||
|
||||
$this->mapField($fieldMapping);
|
||||
}
|
||||
|
@ -50,6 +50,14 @@ class DefaultNamingStrategy implements NamingStrategy
|
||||
return $propertyName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function embeddedFieldToColumnName($propertyName, $embeddedColumnName)
|
||||
{
|
||||
return $propertyName.ucfirst($embeddedColumnName);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -49,6 +49,16 @@ interface NamingStrategy
|
||||
*/
|
||||
function propertyToColumnName($propertyName, $className = null);
|
||||
|
||||
/**
|
||||
* Returns a column name for an embedded property.
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @param string $embeddedColumnName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function embeddedFieldToColumnName($propertyName, $embeddedColumnName);
|
||||
|
||||
/**
|
||||
* Returns the default reference column name.
|
||||
*
|
||||
|
@ -87,6 +87,14 @@ class UnderscoreNamingStrategy implements NamingStrategy
|
||||
return $this->underscore($propertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function embeddedFieldToColumnName($propertyName, $embeddedColumnName)
|
||||
{
|
||||
return $this->underscore($propertyName).'_'.$embeddedColumnName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user