diff --git a/docs/en/cookbook/sql-table-prefixes.rst b/docs/en/cookbook/sql-table-prefixes.rst index 6ca73c275..66a6aaa2d 100644 --- a/docs/en/cookbook/sql-table-prefixes.rst +++ b/docs/en/cookbook/sql-table-prefixes.rst @@ -39,7 +39,11 @@ appropriate autoloaders. public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs) { $classMetadata = $eventArgs->getClassMetadata(); - $classMetadata->setTableName($this->prefix . $classMetadata->getTableName()); + + if (!$classMetadata->isInheritanceTypeSingleTable() || $classMetadata->getName() === $classMetadata->rootEntityName) { + $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'];