Incorporate DDC-879 into Cookbook.
This commit is contained in:
parent
6bf2f22315
commit
ef8689c400
@ -29,18 +29,25 @@ appropriate autoloaders.
|
||||
|
||||
class TablePrefix
|
||||
{
|
||||
protected $_prefix = '';
|
||||
protected $prefix = '';
|
||||
|
||||
public function __construct($prefix)
|
||||
{
|
||||
$this->_prefix = (string) $prefix;
|
||||
$this->prefix = (string) $prefix;
|
||||
}
|
||||
|
||||
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
|
||||
{
|
||||
$classMetadata = $eventArgs->getClassMetadata();
|
||||
$classMetadata->setTableName($this->_prefix . $classMetadata->getTableName());
|
||||
$classMetadata->setTableName($this->prefix . $classMetadata->getTableName());
|
||||
foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) {
|
||||
if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_MANY) {
|
||||
$mappedTableName = $classMetadata->associationMappings[$fieldName]['joinTable']['name'];
|
||||
$classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $this->prefix . $mappedTableName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Telling the EntityManager about our listener
|
||||
|
@ -1309,11 +1309,7 @@ Path Expressions
|
||||
|
||||
/* "u.Group" */
|
||||
SingleValuedAssociationPathExpression ::= IdentificationVariable "." SingleValuedAssociationField
|
||||
<<<<<<< HEAD:manual/en/dql-doctrine-query-language.txt
|
||||
|
||||
=======
|
||||
|
||||
>>>>>>> ReST:en/reference/dql-doctrine-query-language.rst
|
||||
/* "u.Group.Permissions" */
|
||||
CollectionValuedPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* CollectionValuedAssociationField
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user