From ae39a5d389965757876b022fb704b3bd849b3e08 Mon Sep 17 00:00:00 2001 From: "Roman S. Borschel" Date: Tue, 27 Apr 2010 20:11:42 +0200 Subject: [PATCH 1/6] Fixed svn dependency in build file and some weird issues where the oci8 driver loses spaces in the sql while transforming positional to named parameters. --- build.xml | 8 ++++---- lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php | 1 + lib/Doctrine/ORM/Persisters/BasicEntityPersister.php | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/build.xml b/build.xml index ca368eb5a..54693d2c2 100644 --- a/build.xml +++ b/build.xml @@ -142,16 +142,16 @@ - - + + - - + + diff --git a/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php b/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php index 78b21796d..4ebdbec1c 100644 --- a/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php +++ b/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php @@ -60,6 +60,7 @@ class OCI8Statement implements \Doctrine\DBAL\Driver\Statement * placeholders and converted to a named parameter. * * @param string $statement The SQL statement to convert. + * @todo review and test for lost spaces. we experienced missing spaces with oci8 in some sql statements. */ private function _convertPositionalToNamedPlaceholders($statement) { diff --git a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php index 9b8609850..54c7e5195 100644 --- a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php @@ -815,7 +815,7 @@ class BasicEntityPersister : $baseTableAlias; $columnName = $this->_class->getQuotedColumnName($fieldName, $this->_platform); - $orderBySql .= $orderBySql ? ', ' : 'ORDER BY '; + $orderBySql .= $orderBySql ? ', ' : ' ORDER BY '; $orderBySql .= $tableAlias . '.' . $columnName . ' ' . $orientation; } From 47ebbb4312d53da54d066717bea1886369299528 Mon Sep 17 00:00:00 2001 From: "Roman S. Borschel" Date: Tue, 27 Apr 2010 23:18:28 +0200 Subject: [PATCH 2/6] Updated build.xml with new pear channel URLs. --- build.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.xml b/build.xml index 54693d2c2..7665bdb63 100644 --- a/build.xml +++ b/build.xml @@ -163,7 +163,7 @@ DoctrineCommon Common Doctrine code - pear.phpdoctrine.org + pear.doctrine-project.org The Doctrine Common package contains shared code between the other packages. @@ -182,7 +182,7 @@ DoctrineDBAL Doctrine Database Abstraction Layer - pear.phpdoctrine.org + pear.doctrine-project.org The Doctrine DBAL package is the database abstraction layer used to power the ORM package. @@ -201,7 +201,7 @@ DoctrineORM Doctrine Object Relationl Mapper - pear.phpdoctrine.org + pear.doctrine-project.org The Doctrine ORM package is the primary package containing the object relational mapper. From de72db2a7a1b9efe0f77a6746baf6c9fe789c2f2 Mon Sep 17 00:00:00 2001 From: "Jonathan H. Wage" Date: Wed, 28 Apr 2010 11:39:47 -0400 Subject: [PATCH 3/6] Fixing xml schema generation for code completion in ides --- lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php index 366e14de8..23466a1b9 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php @@ -53,7 +53,7 @@ class XmlExporter extends AbstractExporter $xml->addAttribute('xmlns', 'http://doctrine-project.org/schemas/orm/doctrine-mapping'); $xml->addAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); - $xml->addAttribute('xsi:schemaLocation', 'http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd'); + $xml->addAttribute('xsi:schemaLocation', 'http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd'); if ($metadata->isMappedSuperclass) { $root = $xml->addChild('mapped-superclass'); From 41e830ca68a8e3a46041a1a368fc6d408d58fa6a Mon Sep 17 00:00:00 2001 From: "Jonathan H. Wage" Date: Thu, 29 Apr 2010 08:13:02 -0400 Subject: [PATCH 4/6] Fixing sequence-generate in XmlDriver --- lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php index 40608d001..3c45ad8a4 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php @@ -203,9 +203,9 @@ class XmlDriver extends AbstractFileDriver if (isset($idElement->{'sequence-generator'})) { $seqGenerator = $idElement->{'sequence-generator'}; $metadata->setSequenceGeneratorDefinition(array( - 'sequenceName' => $seqGenerator->{'sequence-name'}, - 'allocationSize' => $seqGenerator->{'allocation-size'}, - 'initialValue' => $seqGeneratorAnnot->{'initial-value'} + 'sequenceName' => (string)$seqGenerator['sequence-name'], + 'allocationSize' => (string)$seqGenerator['allocation-size'], + 'initialValue' => (string)$seqGeneratorAnnot['initial-value'] )); } else if (isset($idElement->{'table-generator'})) { throw MappingException::tableIdGeneratorNotImplemented($className); From db2be55e27c87fa513073b2bf44456f1d1423582 Mon Sep 17 00:00:00 2001 From: "Roman S. Borschel" Date: Fri, 30 Apr 2010 17:30:27 +0200 Subject: [PATCH 5/6] [DDC-561] Fixed. --- lib/Doctrine/ORM/Mapping/AssociationMapping.php | 3 ++- lib/Doctrine/ORM/Mapping/ClassMetadata.php | 1 + lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php | 2 +- lib/Doctrine/ORM/PersistentCollection.php | 2 +- tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php | 2 ++ 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/AssociationMapping.php b/lib/Doctrine/ORM/Mapping/AssociationMapping.php index cadda07e3..488bcd0ff 100644 --- a/lib/Doctrine/ORM/Mapping/AssociationMapping.php +++ b/lib/Doctrine/ORM/Mapping/AssociationMapping.php @@ -356,7 +356,8 @@ abstract class AssociationMapping $serialized = array( 'sourceEntityName', 'targetEntityName', - 'sourceFieldName' + 'sourceFieldName', + 'fetchMode' ); if ($this->isCascadeDetach) { diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadata.php b/lib/Doctrine/ORM/Mapping/ClassMetadata.php index a659e8235..18558c01a 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadata.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadata.php @@ -286,6 +286,7 @@ class ClassMetadata extends ClassMetadataInfo 'identifier', 'isIdentifierComposite', // TODO: REMOVE 'name', + 'namespace', // TODO: REMOVE 'table', 'rootEntityName', 'idGenerator', //TODO: Does not really need to be serialized. Could be moved to runtime. diff --git a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php index ec3d92f7b..e44af01cf 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php @@ -143,7 +143,7 @@ class AnnotationDriver implements Driver throw MappingException::classIsNotAValidEntityOrMappedSuperClass($className); } - // Evaluate DoctrineTable annotation + // Evaluate Table annotation if (isset($classAnnotations['Doctrine\ORM\Mapping\Table'])) { $tableAnnot = $classAnnotations['Doctrine\ORM\Mapping\Table']; $primaryTable = array( diff --git a/lib/Doctrine/ORM/PersistentCollection.php b/lib/Doctrine/ORM/PersistentCollection.php index 81d9a3e07..afbbf361f 100644 --- a/lib/Doctrine/ORM/PersistentCollection.php +++ b/lib/Doctrine/ORM/PersistentCollection.php @@ -359,7 +359,7 @@ final class PersistentCollection implements Collection $this->_em->getUnitOfWork()->scheduleOrphanRemoval($removed); } } - + return $removed; } diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php index 92231ae8e..96fc026f7 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php @@ -37,6 +37,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase // Check state $this->assertTrue(count($cm->getReflectionProperties()) > 0); + $this->assertEquals('Doctrine\Tests\Models\CMS', $cm->namespace); $this->assertTrue($cm->reflClass instanceof \ReflectionClass); $this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->name); $this->assertEquals('UserParent', $cm->rootEntityName); @@ -47,6 +48,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase $this->assertTrue($cm->getAssociationMapping('phonenumbers') instanceof \Doctrine\ORM\Mapping\OneToOneMapping); $this->assertEquals(1, count($cm->associationMappings)); $oneOneMapping = $cm->getAssociationMapping('phonenumbers'); + $this->assertTrue($oneOneMapping->fetchMode == \Doctrine\ORM\Mapping\AssociationMapping::FETCH_LAZY); $this->assertEquals('phonenumbers', $oneOneMapping->sourceFieldName); $this->assertEquals('Doctrine\Tests\Models\CMS\Bar', $oneOneMapping->targetEntityName); } From 94928c5dd8e7c18ba7f09c6e650dc13b1d4a0733 Mon Sep 17 00:00:00 2001 From: "Jonathan H. Wage" Date: Fri, 30 Apr 2010 12:27:52 -0400 Subject: [PATCH 6/6] [DDC-552] Fixing issue with getReflectionClass() not existing on ClassMetadataInfo when it is required by AnnotationDriver --- lib/Doctrine/ORM/Mapping/ClassMetadata.php | 17 -------------- .../ORM/Mapping/ClassMetadataInfo.php | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadata.php b/lib/Doctrine/ORM/Mapping/ClassMetadata.php index 18558c01a..48bbc996a 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadata.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadata.php @@ -41,13 +41,6 @@ use ReflectionClass, ReflectionProperty; */ class ClassMetadata extends ClassMetadataInfo { - /** - * The ReflectionClass instance of the mapped class. - * - * @var ReflectionClass - */ - public $reflClass; - /** * The ReflectionProperty instances of the mapped class. * @@ -76,16 +69,6 @@ class ClassMetadata extends ClassMetadataInfo $this->table['name'] = $this->reflClass->getShortName(); } - /** - * Gets the ReflectionClass instance of the mapped class. - * - * @return ReflectionClass - */ - public function getReflectionClass() - { - return $this->reflClass; - } - /** * Gets the ReflectionPropertys of the mapped class. * diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index ac481c48f..d1f13f002 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -19,6 +19,8 @@ namespace Doctrine\ORM\Mapping; +use ReflectionClass; + /** * A ClassMetadata instance holds all the object-relational mapping metadata * of an entity and it's associations. @@ -366,6 +368,13 @@ class ClassMetadataInfo */ public $versionField; + /** + * The ReflectionClass instance of the mapped class. + * + * @var ReflectionClass + */ + public $reflClass; + /** * Initializes a new ClassMetadata instance that will hold the object-relational mapping * metadata of the class with the given name. @@ -378,6 +387,19 @@ class ClassMetadataInfo $this->rootEntityName = $entityName; } + /** + * Gets the ReflectionClass instance of the mapped class. + * + * @return ReflectionClass + */ + public function getReflectionClass() + { + if ( ! $this->reflClass) { + $this->reflClass = new ReflectionClass($entityName); + } + return $this->reflClass; + } + /** * Sets the change tracking policy used by this class. *