1
0
mirror of synced 2025-01-29 19:41:45 +03:00

fix DDC-1719 in persiter and query level

This commit is contained in:
Fabio B. Silva 2012-06-04 15:16:20 -03:00
parent fabfb66293
commit 8fec73673d
8 changed files with 13 additions and 13 deletions

View File

@ -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()

View File

@ -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'];

View File

@ -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>.
*/

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}

View File

@ -16,8 +16,6 @@ class DDC1719Test extends \Doctrine\Tests\OrmFunctionalTestCase
protected function setUp()
{
$this->markTestIncomplete();
parent::setUp();
try {
$this->_schemaTool->createSchema(array(

View File

@ -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(