fix DDC-1719 in persiter and query level
This commit is contained in:
parent
fabfb66293
commit
8fec73673d
@ -633,7 +633,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
|
||||
/**
|
||||
* Set quote strategy class.
|
||||
*
|
||||
* @since 2.4
|
||||
* @since 2.3
|
||||
* @param string $className
|
||||
*/
|
||||
public function setQuoteStrategyClassName($className)
|
||||
@ -650,7 +650,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
|
||||
/**
|
||||
* Get quote strategy class.
|
||||
*
|
||||
* @since 2.4
|
||||
* @since 2.3
|
||||
* @return string
|
||||
*/
|
||||
public function getQuoteStrategyClassName()
|
||||
|
@ -1379,6 +1379,11 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
if (empty($joinColumn['referencedColumnName'])) {
|
||||
$joinColumn['referencedColumnName'] = $this->namingStrategy->referenceColumnName();
|
||||
}
|
||||
if ($joinColumn['name'][0] == '`') {
|
||||
$joinColumn['name'] = trim($joinColumn['name'], '`');
|
||||
$joinColumn['quoted'] = true;
|
||||
}
|
||||
|
||||
$mapping['sourceToTargetKeyColumns'][$joinColumn['name']] = $joinColumn['referencedColumnName'];
|
||||
$mapping['joinColumnFieldNames'][$joinColumn['name']] = isset($joinColumn['fieldName'])
|
||||
? $joinColumn['fieldName'] : $joinColumn['name'];
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
@ -14,7 +13,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
@ -14,7 +13,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
@ -28,7 +27,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.4
|
||||
* @since 2.3
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
abstract class QuoteStrategy
|
||||
|
@ -469,7 +469,7 @@ class BasicEntityPersister
|
||||
$identifier = $this->_em->getUnitOfWork()->getEntityIdentifier($entity);
|
||||
$this->deleteJoinTableRecords($identifier);
|
||||
|
||||
$id = array_combine($this->_class->getIdentifierColumnNames(), $identifier);
|
||||
$id = array_combine($this->quoteStrategy->getIdentifierColumnNames($this->_class), $identifier);
|
||||
$this->_conn->delete($this->quoteStrategy->getTableName($this->_class), $id);
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ class SchemaTool
|
||||
$pkColumns = array();
|
||||
foreach ($class->identifier as $identifierField) {
|
||||
if (isset($class->fieldMappings[$identifierField])) {
|
||||
$pkColumns[] = $this->quoteStrategy->getColumnName($identifierField, $class);
|
||||
$pkColumns[] = $class->getColumnName($identifierField);
|
||||
} else if (isset($class->associationMappings[$identifierField])) {
|
||||
/* @var $assoc \Doctrine\ORM\Mapping\OneToOne */
|
||||
$assoc = $class->associationMappings[$identifierField];
|
||||
@ -226,6 +226,7 @@ class SchemaTool
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$table->hasIndex('primary')) {
|
||||
$table->setPrimaryKey($pkColumns);
|
||||
}
|
||||
|
@ -16,8 +16,6 @@ class DDC1719Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
|
||||
parent::setUp();
|
||||
try {
|
||||
$this->_schemaTool->createSchema(array(
|
||||
|
@ -138,8 +138,6 @@ class QuoteStrategyTest extends \Doctrine\Tests\OrmTestCase
|
||||
|
||||
public function testQuoteJoinColumnNames()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
|
||||
$cm = $this->createClassMetadata('Doctrine\Tests\Models\DDC117\DDC117ArticleDetails');
|
||||
|
||||
$cm->mapOneToOne(array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user