From ef8689c400da91ec739aeb72a0e268c60dfe73e7 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Tue, 28 Dec 2010 00:23:06 +0100 Subject: [PATCH] Incorporate DDC-879 into Cookbook. --- en/cookbook/sql-table-prefixes.rst | 13 ++++++++++--- en/reference/dql-doctrine-query-language.rst | 4 ---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/en/cookbook/sql-table-prefixes.rst b/en/cookbook/sql-table-prefixes.rst index 7e1579286..6ca73c275 100644 --- a/en/cookbook/sql-table-prefixes.rst +++ b/en/cookbook/sql-table-prefixes.rst @@ -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 diff --git a/en/reference/dql-doctrine-query-language.rst b/en/reference/dql-doctrine-query-language.rst index 710fafd2d..18c9a4568 100644 --- a/en/reference/dql-doctrine-query-language.rst +++ b/en/reference/dql-doctrine-query-language.rst @@ -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