1
0
mirror of synced 2024-12-05 03:06:05 +03:00

Include className in calls to NamingStrategy joinColumnName method.

This commit is contained in:
Jack Sleight 2015-01-14 16:32:23 +00:00 committed by Marco Pivetta
parent 4cde35dc18
commit 82163a3301
5 changed files with 7 additions and 7 deletions

View File

@ -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();
}

View File

@ -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'])) {

View File

@ -69,7 +69,7 @@ class DefaultNamingStrategy implements NamingStrategy
/**
* {@inheritdoc}
*/
public function joinColumnName($propertyName)
public function joinColumnName($propertyName, $className = null)
{
return $propertyName . '_' . $this->referenceColumnName();
}

View File

@ -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.

View File

@ -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();
}