Include className in calls to NamingStrategy joinColumnName method.
This commit is contained in:
parent
4cde35dc18
commit
82163a3301
@ -78,7 +78,7 @@ a "naming standard" for database tables and columns.
|
||||
* @param string $propertyName A property
|
||||
* @return string A join column name
|
||||
*/
|
||||
function joinColumnName($propertyName);
|
||||
function joinColumnName($propertyName, $className = null);
|
||||
|
||||
/**
|
||||
* Return a join table name
|
||||
@ -124,7 +124,7 @@ You need to implements NamingStrategy first. Following is an example
|
||||
{
|
||||
return 'id';
|
||||
}
|
||||
public function joinColumnName($propertyName)
|
||||
public function joinColumnName($propertyName, $className = null)
|
||||
{
|
||||
return $propertyName . '_' . $this->referenceColumnName();
|
||||
}
|
||||
|
@ -1553,7 +1553,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
if ( ! isset($mapping['joinColumns']) || ! $mapping['joinColumns']) {
|
||||
// Apply default join column
|
||||
$mapping['joinColumns'] = array(array(
|
||||
'name' => $this->namingStrategy->joinColumnName($mapping['fieldName']),
|
||||
'name' => $this->namingStrategy->joinColumnName($mapping['fieldName'], $this->name),
|
||||
'referencedColumnName' => $this->namingStrategy->referenceColumnName()
|
||||
));
|
||||
}
|
||||
@ -1571,7 +1571,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
}
|
||||
|
||||
if (empty($joinColumn['name'])) {
|
||||
$joinColumn['name'] = $this->namingStrategy->joinColumnName($mapping['fieldName']);
|
||||
$joinColumn['name'] = $this->namingStrategy->joinColumnName($mapping['fieldName'], $this->name);
|
||||
}
|
||||
|
||||
if (empty($joinColumn['referencedColumnName'])) {
|
||||
|
@ -69,7 +69,7 @@ class DefaultNamingStrategy implements NamingStrategy
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function joinColumnName($propertyName)
|
||||
public function joinColumnName($propertyName, $className = null)
|
||||
{
|
||||
return $propertyName . '_' . $this->referenceColumnName();
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ interface NamingStrategy
|
||||
*
|
||||
* @return string A join column name.
|
||||
*/
|
||||
function joinColumnName($propertyName);
|
||||
function joinColumnName($propertyName, $className = null);
|
||||
|
||||
/**
|
||||
* Returns a join table name.
|
||||
|
@ -106,7 +106,7 @@ class UnderscoreNamingStrategy implements NamingStrategy
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function joinColumnName($propertyName)
|
||||
public function joinColumnName($propertyName, $className = null)
|
||||
{
|
||||
return $this->underscore($propertyName) . '_' . $this->referenceColumnName();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user