1
0
Fork 0
mirror of synced 2025-04-03 13:23:37 +03:00

Incorporate DDC-879 into Cookbook.

This commit is contained in:
Benjamin Eberlei 2010-12-28 00:23:06 +01:00
parent 6bf2f22315
commit ef8689c400
2 changed files with 10 additions and 7 deletions

View file

@ -29,18 +29,25 @@ appropriate autoloaders.
class TablePrefix class TablePrefix
{ {
protected $_prefix = ''; protected $prefix = '';
public function __construct($prefix) public function __construct($prefix)
{ {
$this->_prefix = (string) $prefix; $this->prefix = (string) $prefix;
} }
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs) public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{ {
$classMetadata = $eventArgs->getClassMetadata(); $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 Telling the EntityManager about our listener

View file

@ -1309,11 +1309,7 @@ Path Expressions
/* "u.Group" */ /* "u.Group" */
SingleValuedAssociationPathExpression ::= IdentificationVariable "." SingleValuedAssociationField SingleValuedAssociationPathExpression ::= IdentificationVariable "." SingleValuedAssociationField
<<<<<<< HEAD:manual/en/dql-doctrine-query-language.txt
=======
>>>>>>> ReST:en/reference/dql-doctrine-query-language.rst
/* "u.Group.Permissions" */ /* "u.Group.Permissions" */
CollectionValuedPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* CollectionValuedAssociationField CollectionValuedPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* CollectionValuedAssociationField