1
0
mirror of synced 2025-02-20 14:13:15 +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. * Set quote strategy class.
* *
* @since 2.4 * @since 2.3
* @param string $className * @param string $className
*/ */
public function setQuoteStrategyClassName($className) public function setQuoteStrategyClassName($className)
@ -650,7 +650,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
/** /**
* Get quote strategy class. * Get quote strategy class.
* *
* @since 2.4 * @since 2.3
* @return string * @return string
*/ */
public function getQuoteStrategyClassName() public function getQuoteStrategyClassName()

View File

@ -1379,6 +1379,11 @@ class ClassMetadataInfo implements ClassMetadata
if (empty($joinColumn['referencedColumnName'])) { if (empty($joinColumn['referencedColumnName'])) {
$joinColumn['referencedColumnName'] = $this->namingStrategy->referenceColumnName(); $joinColumn['referencedColumnName'] = $this->namingStrategy->referenceColumnName();
} }
if ($joinColumn['name'][0] == '`') {
$joinColumn['name'] = trim($joinColumn['name'], '`');
$joinColumn['quoted'] = true;
}
$mapping['sourceToTargetKeyColumns'][$joinColumn['name']] = $joinColumn['referencedColumnName']; $mapping['sourceToTargetKeyColumns'][$joinColumn['name']] = $joinColumn['referencedColumnName'];
$mapping['joinColumnFieldNames'][$joinColumn['name']] = isset($joinColumn['fieldName']) $mapping['joinColumnFieldNames'][$joinColumn['name']] = isset($joinColumn['fieldName'])
? $joinColumn['fieldName'] : $joinColumn['name']; ? $joinColumn['fieldName'] : $joinColumn['name'];

View File

@ -1,5 +1,4 @@
<?php <?php
/* /*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * "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. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* This software consists of voluntary contributions made by many individuals * 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>. * <http://www.doctrine-project.org>.
*/ */

View File

@ -1,5 +1,4 @@
<?php <?php
/* /*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * "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. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* This software consists of voluntary contributions made by many individuals * 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>. * <http://www.doctrine-project.org>.
*/ */
@ -28,7 +27,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.4 * @since 2.3
* @author Fabio B. Silva <fabio.bat.silva@gmail.com> * @author Fabio B. Silva <fabio.bat.silva@gmail.com>
*/ */
abstract class QuoteStrategy abstract class QuoteStrategy

View File

@ -469,7 +469,7 @@ class BasicEntityPersister
$identifier = $this->_em->getUnitOfWork()->getEntityIdentifier($entity); $identifier = $this->_em->getUnitOfWork()->getEntityIdentifier($entity);
$this->deleteJoinTableRecords($identifier); $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); $this->_conn->delete($this->quoteStrategy->getTableName($this->_class), $id);
} }

View File

@ -217,7 +217,7 @@ class SchemaTool
$pkColumns = array(); $pkColumns = array();
foreach ($class->identifier as $identifierField) { foreach ($class->identifier as $identifierField) {
if (isset($class->fieldMappings[$identifierField])) { if (isset($class->fieldMappings[$identifierField])) {
$pkColumns[] = $this->quoteStrategy->getColumnName($identifierField, $class); $pkColumns[] = $class->getColumnName($identifierField);
} else if (isset($class->associationMappings[$identifierField])) { } else if (isset($class->associationMappings[$identifierField])) {
/* @var $assoc \Doctrine\ORM\Mapping\OneToOne */ /* @var $assoc \Doctrine\ORM\Mapping\OneToOne */
$assoc = $class->associationMappings[$identifierField]; $assoc = $class->associationMappings[$identifierField];
@ -226,6 +226,7 @@ class SchemaTool
} }
} }
} }
if (!$table->hasIndex('primary')) { if (!$table->hasIndex('primary')) {
$table->setPrimaryKey($pkColumns); $table->setPrimaryKey($pkColumns);
} }

View File

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

View File

@ -138,8 +138,6 @@ class QuoteStrategyTest extends \Doctrine\Tests\OrmTestCase
public function testQuoteJoinColumnNames() public function testQuoteJoinColumnNames()
{ {
$this->markTestIncomplete();
$cm = $this->createClassMetadata('Doctrine\Tests\Models\DDC117\DDC117ArticleDetails'); $cm = $this->createClassMetadata('Doctrine\Tests\Models\DDC117\DDC117ArticleDetails');
$cm->mapOneToOne(array( $cm->mapOneToOne(array(