From 9ae30421dd80683e1c26b09de7d86000ddeadd1c Mon Sep 17 00:00:00 2001 From: Michael Ridgway Date: Tue, 28 Jun 2011 15:50:14 -0400 Subject: [PATCH 01/35] Removed onUpdate property on join columns --- lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php | 4 ---- lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php | 1 - lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php | 4 ---- lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php | 4 ---- lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php | 1 - lib/Doctrine/ORM/Tools/EntityGenerator.php | 4 ---- lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php | 9 --------- lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php | 3 --- lib/Doctrine/ORM/Tools/SchemaTool.php | 4 ---- .../Doctrine/Tests/ORM/Functional/Ticket/DDC448Test.php | 2 +- .../Tests/ORM/Mapping/AbstractMappingDriverTest.php | 6 ++---- .../ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php | 1 - .../Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml | 1 - .../Tools/Export/AbstractClassMetadataExporterTest.php | 1 - .../annotation/Doctrine.Tests.ORM.Tools.Export.User.php | 2 +- .../Export/php/Doctrine.Tests.ORM.Tools.Export.User.php | 1 - .../Doctrine/Tests/ORM/Tools/doctrine1schema/schema.yml | 1 - 17 files changed, 4 insertions(+), 45 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php index e30b9bf01..2303f7f15 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php @@ -244,7 +244,6 @@ class AnnotationDriver implements Driver 'unique' => $joinColumnAnnot->unique, 'nullable' => $joinColumnAnnot->nullable, 'onDelete' => $joinColumnAnnot->onDelete, - 'onUpdate' => $joinColumnAnnot->onUpdate, 'columnDefinition' => $joinColumnAnnot->columnDefinition, ); } else if ($joinColumnsAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\JoinColumns')) { @@ -255,7 +254,6 @@ class AnnotationDriver implements Driver 'unique' => $joinColumn->unique, 'nullable' => $joinColumn->nullable, 'onDelete' => $joinColumn->onDelete, - 'onUpdate' => $joinColumn->onUpdate, 'columnDefinition' => $joinColumn->columnDefinition, ); } @@ -363,7 +361,6 @@ class AnnotationDriver implements Driver 'unique' => $joinColumn->unique, 'nullable' => $joinColumn->nullable, 'onDelete' => $joinColumn->onDelete, - 'onUpdate' => $joinColumn->onUpdate, 'columnDefinition' => $joinColumn->columnDefinition, ); } @@ -375,7 +372,6 @@ class AnnotationDriver implements Driver 'unique' => $joinColumn->unique, 'nullable' => $joinColumn->nullable, 'onDelete' => $joinColumn->onDelete, - 'onUpdate' => $joinColumn->onUpdate, 'columnDefinition' => $joinColumn->columnDefinition, ); } diff --git a/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php b/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php index 84d2cd1c8..2a32352c8 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php +++ b/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php @@ -48,7 +48,6 @@ final class JoinColumn extends Annotation { public $unique = false; public $nullable = true; public $onDelete; - public $onUpdate; public $columnDefinition; } final class JoinColumns extends Annotation {} diff --git a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php index b41710b4b..c26a2a35c 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php @@ -471,10 +471,6 @@ class XmlDriver extends AbstractFileDriver $joinColumn['onDelete'] = (string)$joinColumnElement['on-delete']; } - if (isset($joinColumnElement['on-update'])) { - $joinColumn['onUpdate'] = (string)$joinColumnElement['on-update']; - } - if (isset($joinColumnElement['column-definition'])) { $joinColumn['columnDefinition'] = (string)$joinColumnElement['column-definition']; } diff --git a/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php index 47eb07c45..2d4ca5843 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php @@ -490,10 +490,6 @@ class YamlDriver extends AbstractFileDriver $joinColumn['onDelete'] = $joinColumnElement['onDelete']; } - if (isset($joinColumnElement['onUpdate'])) { - $joinColumn['onUpdate'] = $joinColumnElement['onUpdate']; - } - if (isset($joinColumnElement['columnDefinition'])) { $joinColumn['columnDefinition'] = $joinColumnElement['columnDefinition']; } diff --git a/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php b/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php index 1a5600cdb..fd4ed3a41 100644 --- a/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php +++ b/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php @@ -248,7 +248,6 @@ class ConvertDoctrine1Schema 'name' => $relation['local'], 'referencedColumnName' => $relation['foreign'], 'onDelete' => isset($relation['onDelete']) ? $relation['onDelete'] : null, - 'onUpdate' => isset($relation['onUpdate']) ? $relation['onUpdate'] : null, ) ); } diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index 4221c9db7..9d4f490dd 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -762,10 +762,6 @@ public function () $joinColumnAnnot[] = 'onDelete=' . ($joinColumn['onDelete'] ? 'true' : 'false'); } - if (isset($joinColumn['onUpdate'])) { - $joinColumnAnnot[] = 'onUpdate=' . ($joinColumn['onUpdate'] ? 'true' : 'false'); - } - if (isset($joinColumn['columnDefinition'])) { $joinColumnAnnot[] = 'columnDefinition="' . $joinColumn['columnDefinition'] . '"'; } diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php index fc27ea911..f9668c78f 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php @@ -215,9 +215,6 @@ class XmlExporter extends AbstractExporter if (isset($joinColumn['onDelete'])) { $joinColumnXml->addAttribute('on-delete', $joinColumn['onDelete']); } - if (isset($joinColumn['onUpdate'])) { - $joinColumnXml->addAttribute('on-update', $joinColumn['onUpdate']); - } } $inverseJoinColumnsXml = $joinTableXml->addChild('inverse-join-columns'); foreach ($associationMapping['joinTable']['inverseJoinColumns'] as $inverseJoinColumn) { @@ -227,9 +224,6 @@ class XmlExporter extends AbstractExporter if (isset($inverseJoinColumn['onDelete'])) { $inverseJoinColumnXml->addAttribute('on-delete', $inverseJoinColumn['onDelete']); } - if (isset($inverseJoinColumn['onUpdate'])) { - $inverseJoinColumnXml->addAttribute('on-update', $inverseJoinColumn['onUpdate']); - } if (isset($inverseJoinColumn['columnDefinition'])) { $inverseJoinColumnXml->addAttribute('column-definition', $inverseJoinColumn['columnDefinition']); } @@ -250,9 +244,6 @@ class XmlExporter extends AbstractExporter if (isset($joinColumn['onDelete'])) { $joinColumnXml->addAttribute('on-delete', $joinColumn['onDelete']); } - if (isset($joinColumn['onUpdate'])) { - $joinColumnXml->addAttribute('on-update', $joinColumn['onUpdate']); - } if (isset($joinColumn['columnDefinition'])) { $joinColumnXml->addAttribute('column-definition', $joinColumn['columnDefinition']); } diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php index 669e76ce4..36e272246 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php @@ -154,9 +154,6 @@ class YamlExporter extends AbstractExporter if (isset($joinColumn['onDelete'])) { $newJoinColumns[$joinColumn['name']]['onDelete'] = $joinColumn['onDelete']; } - if (isset($joinColumn['onUpdate'])) { - $newJoinColumns[$joinColumn['name']]['onUpdate'] = $joinColumn['onUpdate']; - } } $oneToOneMappingArray = array( 'mappedBy' => $associationMapping['mappedBy'], diff --git a/lib/Doctrine/ORM/Tools/SchemaTool.php b/lib/Doctrine/ORM/Tools/SchemaTool.php index d38f5d159..77106ec7d 100644 --- a/lib/Doctrine/ORM/Tools/SchemaTool.php +++ b/lib/Doctrine/ORM/Tools/SchemaTool.php @@ -523,10 +523,6 @@ class SchemaTool $uniqueConstraints[] = array('columns' => array($columnName)); } - if (isset($joinColumn['onUpdate'])) { - $fkOptions['onUpdate'] = $joinColumn['onUpdate']; - } - if (isset($joinColumn['onDelete'])) { $fkOptions['onDelete'] = $joinColumn['onDelete']; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC448Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC448Test.php index 91c9e129e..f0867f352 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC448Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC448Test.php @@ -42,7 +42,7 @@ class DDC448MainTable /** * @ManyToOne(targetEntity="DDC448ConnectedClass", cascade={"all"}, fetch="EAGER") - * @JoinColumn(name="connectedClassId", referencedColumnName="id", onDelete="CASCADE", onUpdate="CASCADE", nullable=true) + * @JoinColumn(name="connectedClassId", referencedColumnName="id", onDelete="CASCADE", nullable=true) */ private $connectedClassId; } diff --git a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php index ee2ea4249..6e4e2f353 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php @@ -267,10 +267,9 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase * @depends testColumnDefinition * @param ClassMetadata $class */ - public function testJoinColumnOnDeleteAndOnUpdate($class) + public function testJoinColumnOnDelete($class) { $this->assertEquals('CASCADE', $class->associationMappings['address']['joinColumns'][0]['onDelete']); - $this->assertEquals('CASCADE', $class->associationMappings['address']['joinColumns'][0]['onUpdate']); return $class; } @@ -324,7 +323,7 @@ class User /** * @OneToOne(targetEntity="Address", cascade={"remove"}, inversedBy="user") - * @JoinColumn(onDelete="CASCADE", onUpdate="CASCADE") + * @JoinColumn(onDelete="CASCADE") */ public $address; @@ -412,7 +411,6 @@ class User 'name' => 'address_id', 'referencedColumnName' => 'id', 'onDelete' => 'CASCADE', - 'onUpdate' => 'CASCADE' ), ), 'orphanRemoval' => false, diff --git a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php index 2abe648ad..505188757 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php +++ b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php @@ -51,7 +51,6 @@ $metadata->mapOneToOne(array( 'name' => 'address_id', 'referencedColumnName' => 'id', 'onDelete' => 'CASCADE', - 'onUpdate' => 'CASCADE' ), ), 'orphanRemoval' => false, diff --git a/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml b/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml index a787a93c9..490a21c2a 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml +++ b/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml @@ -30,7 +30,6 @@ Doctrine\Tests\ORM\Mapping\User: name: address_id referencedColumnName: id onDelete: CASCADE - onUpdate: CASCADE cascade: [ remove ] oneToMany: phonenumbers: diff --git a/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php b/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php index 850fb76ba..11b3d113d 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php @@ -217,7 +217,6 @@ abstract class AbstractClassMetadataExporterTest extends \Doctrine\Tests\OrmTest $this->assertEquals('address_id', $class->associationMappings['address']['joinColumns'][0]['name']); $this->assertEquals('id', $class->associationMappings['address']['joinColumns'][0]['referencedColumnName']); $this->assertEquals('CASCADE', $class->associationMappings['address']['joinColumns'][0]['onDelete']); - $this->assertEquals('CASCADE', $class->associationMappings['address']['joinColumns'][0]['onUpdate']); $this->assertTrue($class->associationMappings['address']['isCascadeRemove']); $this->assertFalse($class->associationMappings['address']['isCascadePersist']); diff --git a/tests/Doctrine/Tests/ORM/Tools/Export/annotation/Doctrine.Tests.ORM.Tools.Export.User.php b/tests/Doctrine/Tests/ORM/Tools/Export/annotation/Doctrine.Tests.ORM.Tools.Export.User.php index e71da460e..4fb951087 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Export/annotation/Doctrine.Tests.ORM.Tools.Export.User.php +++ b/tests/Doctrine/Tests/ORM/Tools/Export/annotation/Doctrine.Tests.ORM.Tools.Export.User.php @@ -24,7 +24,7 @@ class User /** * @OneToOne(targetEntity="Doctrine\Tests\ORM\Tools\Export\Address", cascade={"remove"}, inversedBy="user") - * @JoinColumn(name="address_id", onDelete="CASCADE", onUpdate="CASCADE") + * @JoinColumn(name="address_id", onDelete="CASCADE") */ public $address; diff --git a/tests/Doctrine/Tests/ORM/Tools/Export/php/Doctrine.Tests.ORM.Tools.Export.User.php b/tests/Doctrine/Tests/ORM/Tools/Export/php/Doctrine.Tests.ORM.Tools.Export.User.php index 1a3824543..0dc182168 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Export/php/Doctrine.Tests.ORM.Tools.Export.User.php +++ b/tests/Doctrine/Tests/ORM/Tools/Export/php/Doctrine.Tests.ORM.Tools.Export.User.php @@ -47,7 +47,6 @@ $metadata->mapOneToOne(array( 'name' => 'address_id', 'referencedColumnName' => 'id', 'onDelete' => 'CASCADE', - 'onUpdate' => 'CASCADE' ), ), 'orphanRemoval' => false, diff --git a/tests/Doctrine/Tests/ORM/Tools/doctrine1schema/schema.yml b/tests/Doctrine/Tests/ORM/Tools/doctrine1schema/schema.yml index 67301c05d..efa24c791 100644 --- a/tests/Doctrine/Tests/ORM/Tools/doctrine1schema/schema.yml +++ b/tests/Doctrine/Tests/ORM/Tools/doctrine1schema/schema.yml @@ -24,6 +24,5 @@ Profile: relations: User: onDelete: CASCADE - onUpdate: CASCADE foreignType: one type: one \ No newline at end of file From c19d7fe2ebe465f5cba4e4a45ba8ea119a18a4d9 Mon Sep 17 00:00:00 2001 From: Michael Ridgway Date: Tue, 28 Jun 2011 15:55:43 -0400 Subject: [PATCH 02/35] Missed one --- .../Export/yaml/Doctrine.Tests.ORM.Tools.Export.User.dcm.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Doctrine/Tests/ORM/Tools/Export/yaml/Doctrine.Tests.ORM.Tools.Export.User.dcm.yml b/tests/Doctrine/Tests/ORM/Tools/Export/yaml/Doctrine.Tests.ORM.Tools.Export.User.dcm.yml index 2b3048fba..4c169f8d4 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Export/yaml/Doctrine.Tests.ORM.Tools.Export.User.dcm.yml +++ b/tests/Doctrine/Tests/ORM/Tools/Export/yaml/Doctrine.Tests.ORM.Tools.Export.User.dcm.yml @@ -23,7 +23,6 @@ Doctrine\Tests\ORM\Tools\Export\User: name: address_id referencedColumnName: id onDelete: CASCADE - onUpdate: CASCADE cascade: [ remove ] inversedBy: user oneToMany: From b58f573b3151a492465dabd0de562353771aa899 Mon Sep 17 00:00:00 2001 From: Michel Weimerskirch Date: Tue, 26 Jul 2011 10:59:21 +0300 Subject: [PATCH 03/35] Corrected typo --- lib/Doctrine/ORM/ORMException.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/ORMException.php b/lib/Doctrine/ORM/ORMException.php index 75b91d2e4..fa6fdd30e 100644 --- a/lib/Doctrine/ORM/ORMException.php +++ b/lib/Doctrine/ORM/ORMException.php @@ -39,7 +39,7 @@ class ORMException extends Exception { return new self( "Entity of type " . get_class($entity) . " has identity through a foreign entity " . get_class($relatedEntity) . ", " . - "however this entity has no ientity itself. You have to call EntityManager#persist() on the related entity " . + "however this entity has no identity itself. You have to call EntityManager#persist() on the related entity " . "and make sure it an identifier was generated before trying to persist '" . get_class($entity) . "'. In case " . "of Post Insert ID Generation (such as MySQL Auto-Increment or PostgreSQL SERIAL) this means you have to call " . "EntityManager#flush() between both persist operations." From 6ef4ac62d773755d4655560a2348e8383d1cb553 Mon Sep 17 00:00:00 2001 From: Michel Weimerskirch Date: Tue, 26 Jul 2011 11:03:23 +0300 Subject: [PATCH 04/35] Missed another typo --- lib/Doctrine/ORM/ORMException.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/ORMException.php b/lib/Doctrine/ORM/ORMException.php index fa6fdd30e..89203359c 100644 --- a/lib/Doctrine/ORM/ORMException.php +++ b/lib/Doctrine/ORM/ORMException.php @@ -40,7 +40,7 @@ class ORMException extends Exception return new self( "Entity of type " . get_class($entity) . " has identity through a foreign entity " . get_class($relatedEntity) . ", " . "however this entity has no identity itself. You have to call EntityManager#persist() on the related entity " . - "and make sure it an identifier was generated before trying to persist '" . get_class($entity) . "'. In case " . + "and make sure that an identifier was generated before trying to persist '" . get_class($entity) . "'. In case " . "of Post Insert ID Generation (such as MySQL Auto-Increment or PostgreSQL SERIAL) this means you have to call " . "EntityManager#flush() between both persist operations." ); From 49c735109c998555ad937fb10b781f24959cce10 Mon Sep 17 00:00:00 2001 From: kwiateusz Date: Tue, 26 Jul 2011 11:38:09 +0200 Subject: [PATCH 05/35] Change from assertType to assertInstanceOf. Now PHPUnit doesn't show warning about deprecation of assertType. Also some refractoring from assertTrue($a instanceof $b) to assertInstanceOf. Leading \ in namespaces is not required so I removed it from few assertions. --- tests/Doctrine/Tests/ORM/EntityManagerTest.php | 18 +++++++++--------- .../ORM/Functional/AdvancedAssociationTest.php | 16 ++++++++-------- .../ORM/Functional/BasicFunctionalTest.php | 16 ++++++++-------- .../ORM/Functional/CompositePrimaryKeyTest.php | 2 +- .../Tests/ORM/Functional/DefaultValuesTest.php | 2 +- .../ORM/Functional/EntityRepositoryTest.php | 12 ++++++------ .../ORM/Functional/MappedSuperclassTest.php | 4 ++-- .../OneToOneUnidirectionalAssociationTest.php | 4 ++-- .../Functional/StandardEntityPersisterTest.php | 4 ++-- .../Tests/ORM/Functional/Ticket/DDC237Test.php | 6 +++--- .../Tests/ORM/Functional/Ticket/DDC258Test.php | 2 +- .../Tests/ORM/Functional/Ticket/DDC345Test.php | 2 +- .../Tests/ORM/Functional/Ticket/DDC371Test.php | 2 +- .../Tests/ORM/Functional/Ticket/DDC422Test.php | 2 +- .../Tests/ORM/Functional/Ticket/DDC440Test.php | 4 ++-- .../Tests/ORM/Functional/Ticket/DDC501Test.php | 2 +- .../Tests/ORM/Functional/Ticket/DDC633Test.php | 2 +- .../Tests/ORM/Functional/Ticket/DDC729Test.php | 4 ++-- .../Tests/ORM/Functional/Ticket/DDC736Test.php | 2 +- .../Tests/ORM/Functional/Ticket/DDC748Test.php | 4 ++-- .../Tests/ORM/Functional/Ticket/DDC837Test.php | 8 ++++---- .../Tests/ORM/Functional/Ticket/DDC949Test.php | 4 ++-- .../Tests/ORM/Mapping/ClassMetadataTest.php | 4 ++-- 23 files changed, 63 insertions(+), 63 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/EntityManagerTest.php b/tests/Doctrine/Tests/ORM/EntityManagerTest.php index ca896ad10..f54974a27 100644 --- a/tests/Doctrine/Tests/ORM/EntityManagerTest.php +++ b/tests/Doctrine/Tests/ORM/EntityManagerTest.php @@ -26,32 +26,32 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase public function testGetConnection() { - $this->assertInstanceOf('\Doctrine\DBAL\Connection', $this->_em->getConnection()); + $this->assertInstanceOf('Doctrine\DBAL\Connection', $this->_em->getConnection()); } public function testGetMetadataFactory() { - $this->assertInstanceOf('\Doctrine\ORM\Mapping\ClassMetadataFactory', $this->_em->getMetadataFactory()); + $this->assertInstanceOf('Doctrine\ORM\Mapping\ClassMetadataFactory', $this->_em->getMetadataFactory()); } public function testGetConfiguration() { - $this->assertInstanceOf('\Doctrine\ORM\Configuration', $this->_em->getConfiguration()); + $this->assertInstanceOf('Doctrine\ORM\Configuration', $this->_em->getConfiguration()); } public function testGetUnitOfWork() { - $this->assertInstanceOf('\Doctrine\ORM\UnitOfWork', $this->_em->getUnitOfWork()); + $this->assertInstanceOf('Doctrine\ORM\UnitOfWork', $this->_em->getUnitOfWork()); } public function testGetProxyFactory() { - $this->assertInstanceOf('\Doctrine\ORM\Proxy\ProxyFactory', $this->_em->getProxyFactory()); + $this->assertInstanceOf('Doctrine\ORM\Proxy\ProxyFactory', $this->_em->getProxyFactory()); } public function testGetEventManager() { - $this->assertInstanceOf('\Doctrine\Common\EventManager', $this->_em->getEventManager()); + $this->assertInstanceOf('Doctrine\Common\EventManager', $this->_em->getEventManager()); } public function testCreateNativeQuery() @@ -64,7 +64,7 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase public function testCreateQueryBuilder() { - $this->assertInstanceOf('\Doctrine\ORM\QueryBuilder', $this->_em->createQueryBuilder()); + $this->assertInstanceOf('Doctrine\ORM\QueryBuilder', $this->_em->createQueryBuilder()); } public function testCreateQueryBuilderAliasValid() @@ -83,7 +83,7 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase public function testCreateQuery_DqlIsOptional() { - $this->assertInstanceOf('\Doctrine\ORM\Query', $this->_em->createQuery()); + $this->assertInstanceOf('Doctrine\ORM\Query', $this->_em->createQuery()); } public function testGetPartialReference() @@ -97,7 +97,7 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase public function testCreateQuery() { $q = $this->_em->createQuery('SELECT 1'); - $this->assertInstanceOf('\Doctrine\ORM\Query', $q); + $this->assertInstanceOf('Doctrine\ORM\Query', $q); $this->assertEquals('SELECT 1', $q->getDql()); } diff --git a/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php index a7c9cdc07..c4e43dfad 100644 --- a/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php @@ -64,8 +64,8 @@ class AdvancedAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCase $query = $this->_em->createQuery("SELECT p,t FROM Doctrine\Tests\ORM\Functional\Phrase p JOIN p.type t"); $res = $query->getResult(); $this->assertEquals(1, count($res)); - $this->assertTrue($res[0]->getType() instanceof PhraseType); - $this->assertTrue($res[0]->getType()->getPhrases() instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\PhraseType', $res[0]->getType()); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $res[0]->getType()->getPhrases()); $this->assertFalse($res[0]->getType()->getPhrases()->isInitialized()); $this->_em->clear(); @@ -74,8 +74,8 @@ class AdvancedAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCase $query = $this->_em->createQuery("SELECT p,t,pp FROM Doctrine\Tests\ORM\Functional\Phrase p JOIN p.type t JOIN t.phrases pp"); $res = $query->getResult(); $this->assertEquals(1, count($res)); - $this->assertTrue($res[0]->getType() instanceof PhraseType); - $this->assertTrue($res[0]->getType()->getPhrases() instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\PhraseType', $res[0]->getType()); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $res[0]->getType()->getPhrases()); $this->assertTrue($res[0]->getType()->getPhrases()->isInitialized()); $this->_em->clear(); @@ -83,8 +83,8 @@ class AdvancedAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCase // test3 - lazy-loading one-to-many after find() $phrase3 = $this->_em->find('Doctrine\Tests\ORM\Functional\Phrase', $phrase->getId()); $definitions = $phrase3->getDefinitions(); - $this->assertTrue($definitions instanceof \Doctrine\ORM\PersistentCollection); - $this->assertTrue($definitions[0] instanceof Definition); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $definitions); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Definition', $definitions[0]); $this->_em->clear(); @@ -95,7 +95,7 @@ class AdvancedAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertEquals(1, count($res)); - $this->assertTrue($definitions[0] instanceof Definition); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Definition', $definitions[0]); $this->assertEquals(2, $definitions->count()); } @@ -119,7 +119,7 @@ class AdvancedAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCase $res = $query->getResult(); $types = $res[0]->getTypes(); - $this->assertTrue($types[0] instanceof Type); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Type', $types[0]); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php b/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php index 572b6c73d..f69b3f862 100644 --- a/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php @@ -136,8 +136,8 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase ->getSingleResult(); // Address has been eager-loaded because it cant be lazy - $this->assertTrue($user2->address instanceof CmsAddress); - $this->assertFalse($user2->address instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $user2->address); + $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $user2->address); } /** @@ -276,7 +276,7 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertEquals('Guilherme', $users[0]->name); $this->assertEquals('gblanco', $users[0]->username); $this->assertEquals('developer', $users[0]->status); - $this->assertTrue($users[0]->phonenumbers instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $users[0]->phonenumbers); $this->assertTrue($users[0]->phonenumbers->isInitialized()); $this->assertEquals(0, $users[0]->phonenumbers->count()); //$this->assertNull($users[0]->articles); @@ -520,8 +520,8 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $query = $this->_em->createQuery("select u, a from Doctrine\Tests\Models\CMS\CmsUser u join u.address a where u.username='gblanco'"); $gblanco = $query->getSingleResult(); - $this->assertTrue($gblanco instanceof CmsUser); - $this->assertTrue($gblanco->getAddress() instanceof CmsAddress); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $gblanco); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $gblanco->getAddress()); $this->assertEquals('Berlin', $gblanco->getAddress()->getCity()); } @@ -629,7 +629,7 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $user2 = $query->getSingleResult(); $this->assertEquals(1, count($user2->articles)); - $this->assertTrue($user2->address instanceof CmsAddress); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $user2->address); $oldLogger = $this->_em->getConnection()->getConfiguration()->getSQLLogger(); $debugStack = new \Doctrine\DBAL\Logging\DebugStack; @@ -690,7 +690,7 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase ->setParameter('user', $userRef) ->getSingleResult(); - $this->assertTrue($address2->getUser() instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $address2->getUser()); $this->assertTrue($userRef === $address2->getUser()); $this->assertFalse($userRef->__isInitialized__); $this->assertEquals('Germany', $address2->country); @@ -905,7 +905,7 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->clear(); $user2 = $this->_em->find(get_class($managedUser), $userId); - $this->assertTrue($user2 instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $user2); } public function testMergeThrowsExceptionIfEntityWithGeneratedIdentifierDoesNotExist() diff --git a/tests/Doctrine/Tests/ORM/Functional/CompositePrimaryKeyTest.php b/tests/Doctrine/Tests/ORM/Functional/CompositePrimaryKeyTest.php index 7eced1b84..ee762d345 100644 --- a/tests/Doctrine/Tests/ORM/Functional/CompositePrimaryKeyTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/CompositePrimaryKeyTest.php @@ -45,7 +45,7 @@ class CompositePrimaryKeyTest extends \Doctrine\Tests\OrmFunctionalTestCase $poi = $this->_em->find('Doctrine\Tests\Models\Navigation\NavPointOfInterest', array('lat' => 100, 'long' => 200)); - $this->assertType('Doctrine\Tests\Models\Navigation\NavPointOfInterest', $poi); + $this->assertInstanceOf('Doctrine\Tests\Models\Navigation\NavPointOfInterest', $poi); $this->assertEquals(100, $poi->getLat()); $this->assertEquals(200, $poi->getLong()); $this->assertEquals('Brandenburger Tor', $poi->getName()); diff --git a/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php b/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php index 873f0d938..3da6bc09b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php @@ -50,7 +50,7 @@ class DefaultValuesTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->clear(); $a2 = $this->_em->find(get_class($a), $a->id); - $this->assertTrue($a2->getUser() instanceof DefaultValueUser); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\DefaultValueUser', $a2->getUser()); $this->assertEquals($userId, $a2->getUser()->getId()); $this->assertEquals('Poweruser', $a2->getUser()->type); } diff --git a/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php b/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php index 6c620db38..029d55252 100644 --- a/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php @@ -47,7 +47,7 @@ class EntityRepositoryTest extends \Doctrine\Tests\OrmFunctionalTestCase $repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser'); $user = $repos->find($user1Id); - $this->assertTrue($user instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser',$user); $this->assertEquals('Roman', $user->name); $this->assertEquals('freak', $user->status); } @@ -59,7 +59,7 @@ class EntityRepositoryTest extends \Doctrine\Tests\OrmFunctionalTestCase $users = $repos->findBy(array('status' => 'dev')); $this->assertEquals(1, count($users)); - $this->assertTrue($users[0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser',$users[0]); $this->assertEquals('Guilherme', $users[0]->name); $this->assertEquals('dev', $users[0]->status); } @@ -72,7 +72,7 @@ class EntityRepositoryTest extends \Doctrine\Tests\OrmFunctionalTestCase $users = $repos->findByStatus('dev'); $this->assertEquals(1, count($users)); - $this->assertTrue($users[0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser',$users[0]); $this->assertEquals('Guilherme', $users[0]->name); $this->assertEquals('dev', $users[0]->status); } @@ -244,7 +244,7 @@ class EntityRepositoryTest extends \Doctrine\Tests\OrmFunctionalTestCase $repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsAddress'); $address = $repos->findOneBy(array('user' => $userId)); - $this->assertType('Doctrine\Tests\Models\CMS\CmsAddress', $address); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $address); $this->assertEquals($addressId, $address->id); } @@ -285,7 +285,7 @@ class EntityRepositoryTest extends \Doctrine\Tests\OrmFunctionalTestCase $repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsAddress'); $address = $repos->findOneByUser($userId); - $this->assertType('Doctrine\Tests\Models\CMS\CmsAddress', $address); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $address); $this->assertEquals($addressId, $address->id); } @@ -295,7 +295,7 @@ class EntityRepositoryTest extends \Doctrine\Tests\OrmFunctionalTestCase $query = $repos->createNamedQuery('all'); - $this->assertType('Doctrine\ORM\Query', $query); + $this->assertInstanceOf('Doctrine\ORM\Query', $query); $this->assertEquals('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u', $query->getDQL()); } diff --git a/tests/Doctrine/Tests/ORM/Functional/MappedSuperclassTest.php b/tests/Doctrine/Tests/ORM/Functional/MappedSuperclassTest.php index 9b1f8d607..bb324bf67 100644 --- a/tests/Doctrine/Tests/ORM/Functional/MappedSuperclassTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/MappedSuperclassTest.php @@ -38,9 +38,9 @@ class MappedSuperclassTest extends \Doctrine\Tests\OrmFunctionalTestCase $cleanFile = $this->_em->find(get_class($file), $file->getId()); - $this->assertType('Doctrine\Tests\Models\DirectoryTree\Directory', $cleanFile->getParent()); + $this->assertInstanceOf('Doctrine\Tests\Models\DirectoryTree\Directory', $cleanFile->getParent()); $this->assertEquals($directory->getId(), $cleanFile->getParent()->getId()); - $this->assertType('Doctrine\Tests\Models\DirectoryTree\Directory', $cleanFile->getParent()->getParent()); + $this->assertInstanceOf('Doctrine\Tests\Models\DirectoryTree\Directory', $cleanFile->getParent()->getParent()); $this->assertEquals($root->getId(), $cleanFile->getParent()->getParent()->getId()); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneUnidirectionalAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneUnidirectionalAssociationTest.php index 3adde7c10..ad4dd7404 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneUnidirectionalAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneUnidirectionalAssociationTest.php @@ -56,7 +56,7 @@ class OneToOneUnidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $result = $query->getResult(); $product = $result[0]; - $this->assertTrue($product->getShipping() instanceof ECommerceShipping); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceShipping', $product->getShipping()); $this->assertEquals(1, $product->getShipping()->getDays()); } @@ -69,7 +69,7 @@ class OneToOneUnidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $result = $query->getResult(); $product = $result[0]; - $this->assertTrue($product->getShipping() instanceof ECommerceShipping); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceShipping', $product->getShipping()); $this->assertEquals(1, $product->getShipping()->getDays()); } diff --git a/tests/Doctrine/Tests/ORM/Functional/StandardEntityPersisterTest.php b/tests/Doctrine/Tests/ORM/Functional/StandardEntityPersisterTest.php index 8b37a02ba..e8132de5c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/StandardEntityPersisterTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/StandardEntityPersisterTest.php @@ -64,7 +64,7 @@ class StandardEntityPersisterTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->flush(); $this->assertEquals(2, count($p->getFeatures())); - $this->assertTrue($p->getFeatures() instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $p->getFeatures()); $q = $this->_em->createQuery( 'SELECT p, f @@ -75,7 +75,7 @@ class StandardEntityPersisterTest extends \Doctrine\Tests\OrmFunctionalTestCase $res = $q->getResult(); $this->assertEquals(2, count($p->getFeatures())); - $this->assertTrue($p->getFeatures() instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $p->getFeatures()); // Check that the features are the same instances still foreach ($p->getFeatures() as $feature) { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php index 6dc23c895..4685f1d03 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php @@ -37,7 +37,7 @@ class DDC237Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->clear(); $x2 = $this->_em->find(get_class($x), $x->id); // proxy injected for Y - $this->assertTrue($x2->y instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $x2->y); $this->assertFalse($x2->y->__isInitialized__); // proxy for Y is in identity map @@ -45,7 +45,7 @@ class DDC237Test extends \Doctrine\Tests\OrmFunctionalTestCase $z2 = $this->_em->createQuery('select z,y from ' . get_class($z) . ' z join z.y y where z.id = ?1') ->setParameter(1, $z->id) ->getSingleResult(); - $this->assertTrue($z2->y instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $x2->y); $this->assertTrue($z2->y->__isInitialized__); $this->assertEquals('Y', $z2->y->data); $this->assertEquals($y->id, $z2->y->id); @@ -56,7 +56,7 @@ class DDC237Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertNotSame($x, $x2); $this->assertNotSame($z, $z2); $this->assertSame($z2->y, $x2->y); - $this->assertTrue($z2->y instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $x2->y); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php index 29a35dada..9e92c34ce 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php @@ -44,7 +44,7 @@ class DDC258Test extends \Doctrine\Tests\OrmFunctionalTestCase $e2 = $this->_em->find('Doctrine\Tests\ORM\Functional\Ticket\DDC258Super', $c2->id); - $this->assertType('Doctrine\Tests\ORM\Functional\Ticket\DDC258Class2', $e2); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC258Class2', $e2); $this->assertEquals('Bar', $e2->title); $this->assertEquals('Bar', $e2->description); $this->assertEquals('Bar', $e2->text); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php index 63a084c87..fc2c3fc6d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php @@ -48,7 +48,7 @@ class DDC345Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertEquals(1, $membership->prePersistCallCount); $this->assertEquals(0, $membership->preUpdateCallCount); - $this->assertTrue($membership->updated instanceof \DateTime); + $this->assertInstanceOf('DateTime', $membership->updated); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php index 399e35c34..ad1584fa0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php @@ -41,7 +41,7 @@ class DDC371Test extends \Doctrine\Tests\OrmFunctionalTestCase ->getResult(); $this->assertEquals(1, count($children)); - $this->assertFalse($children[0]->parent instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $children[0]->parent); $this->assertFalse($children[0]->parent->children->isInitialized()); $this->assertEquals(0, $children[0]->parent->children->unwrap()->count()); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php index bec65acae..ebe9f9d55 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php @@ -28,7 +28,7 @@ class DDC422Test extends \Doctrine\Tests\OrmFunctionalTestCase $customer = $this->_em->find(get_class($customer), $customer->id); - $this->assertTrue($customer->contacts instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $customer->contacts); $this->assertFalse($customer->contacts->isInitialized()); $contact = new DDC422Contact; $customer->contacts->add($contact); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php index a11c62407..46096fe5b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php @@ -64,13 +64,13 @@ class DDC440Test extends \Doctrine\Tests\OrmFunctionalTestCase // Test the first phone. The assertion actually failed because original entity data is not set properly. // This was because it is also set as MainPhone and that one is created as a proxy, not the // original object when the find on Client is called. However loading proxies did not work correctly. - $this->assertType('Doctrine\Tests\ORM\Functional\Ticket\DDC440Phone', $p1); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC440Phone', $p1); $originalData = $uw->getOriginalEntityData($p1); $this->assertEquals($phone->getNumber(), $originalData['number']); //If you comment out previous test, this one should pass - $this->assertType('Doctrine\Tests\ORM\Functional\Ticket\DDC440Phone', $p2); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC440Phone', $p2); $originalData = $uw->getOriginalEntityData($p2); $this->assertEquals($phone2->getNumber(), $originalData['number']); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php index 99da4c203..45c4340dc 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php @@ -50,7 +50,7 @@ class DDC501Test extends OrmFunctionalTestCase // freeze and unfreeze $userClone = unserialize(serialize($userReloaded)); - $this->assertType('Doctrine\Tests\Models\CMS\CmsUser', $userClone); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $userClone); // detached user can't know about his phonenumbers $this->assertEquals(0, count($userClone->getPhonenumbers())); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php index d51bdd361..fa7e0af2f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php @@ -66,7 +66,7 @@ class DDC633Test extends \Doctrine\Tests\OrmFunctionalTestCase $appointments = $this->_em->createQuery("SELECT a FROM " . __NAMESPACE__ . "\DDC633Appointment a")->getResult(); foreach ($appointments AS $eagerAppointment) { - $this->assertType('Doctrine\ORM\Proxy\Proxy', $eagerAppointment->patient); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $eagerAppointment->patient); $this->assertTrue($eagerAppointment->patient->__isInitialized__, "Proxy should already be initialized due to eager loading!"); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php index c2be27b11..939c35d7b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php @@ -36,11 +36,11 @@ class DDC729Test extends \Doctrine\Tests\OrmFunctionalTestCase $a = new DDC729A(); $a->id = $aId; - $this->assertType('Doctrine\Common\Collections\ArrayCollection', $a->related); + $this->assertInstanceOf('Doctrine\Common\Collections\ArrayCollection', $a->related); $a = $this->_em->merge($a); - $this->assertType('Doctrine\ORM\PersistentCollection', $a->related); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $a->related); $this->assertFalse($a->related->isInitialized(), "Collection should not be marked initialized."); $this->assertFalse($a->related->isDirty(), "Collection should not be marked as dirty."); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC736Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC736Test.php index 66c73bb78..de9e275bf 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC736Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC736Test.php @@ -72,7 +72,7 @@ class DDC736Test extends \Doctrine\Tests\OrmFunctionalTestCase /* @var $cart2 Doctrine\Tests\Models\ECommerce\ECommerceCart */ $cart2 = $result[0][0]; - $this->assertType('Doctrine\ORM\Proxy\Proxy', $cart2->getCustomer()); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $cart2->getCustomer()); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC748Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC748Test.php index 1548552d7..9954a697b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC748Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC748Test.php @@ -33,10 +33,10 @@ class DDC748Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->persist($article); $this->_em->flush(); - $this->assertType('Doctrine\Common\Collections\Collection', $user->articles); + $this->assertInstanceOf('Doctrine\Common\Collections\Collection', $user->articles); $this->_em->refresh($article); $this->assertTrue($article !== $user->articles, "The article should not be replaced on the inverse side of the relation."); - $this->assertType('Doctrine\Common\Collections\Collection', $user->articles); + $this->assertInstanceOf('Doctrine\Common\Collections\Collection', $user->articles); } public function testRefreshOneToOne() diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC837Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC837Test.php index 6afea88cd..1665b1585 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC837Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC837Test.php @@ -52,20 +52,20 @@ class DDC837Test extends \Doctrine\Tests\OrmFunctionalTestCase // Test Class1 $e1 = $this->_em->find('Doctrine\Tests\ORM\Functional\Ticket\DDC837Super', $c1->id); - $this->assertType('Doctrine\Tests\ORM\Functional\Ticket\DDC837Class1', $e1); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC837Class1', $e1); $this->assertEquals('Foo', $e1->title); $this->assertEquals('Foo', $e1->description); - $this->assertType(__NAMESPACE__ . '\DDC837Aggregate', $e1->aggregate); + $this->assertInstanceOf(__NAMESPACE__ . '\DDC837Aggregate', $e1->aggregate); $this->assertEquals('test1', $e1->aggregate->getSysname()); // Test Class 2 $e2 = $this->_em->find('Doctrine\Tests\ORM\Functional\Ticket\DDC837Super', $c2->id); - $this->assertType('Doctrine\Tests\ORM\Functional\Ticket\DDC837Class2', $e2); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC837Class2', $e2); $this->assertEquals('Bar', $e2->title); $this->assertEquals('Bar', $e2->description); $this->assertEquals('Bar', $e2->text); - $this->assertType(__NAMESPACE__ . '\DDC837Aggregate', $e2->aggregate); + $this->assertInstanceOf(__NAMESPACE__ . '\DDC837Aggregate', $e2->aggregate); $this->assertEquals('test2', $e2->aggregate->getSysname()); $all = $this->_em->getRepository(__NAMESPACE__.'\DDC837Super')->findAll(); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC949Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC949Test.php index adab29d93..473a8679f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC949Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC949Test.php @@ -34,10 +34,10 @@ class DDC949Test extends \Doctrine\Tests\OrmFunctionalTestCase $true = $this->_em->getRepository('Doctrine\Tests\Models\Generic\BooleanModel')->findOneBy(array('booleanField' => true)); $false = $this->_em->getRepository('Doctrine\Tests\Models\Generic\BooleanModel')->findOneBy(array('booleanField' => false)); - $this->assertType('Doctrine\Tests\Models\Generic\BooleanModel', $true); + $this->assertInstanceOf('Doctrine\Tests\Models\Generic\BooleanModel', $true); $this->assertTrue($true->booleanField, "True Boolean Model should be true."); - $this->assertType('Doctrine\Tests\Models\Generic\BooleanModel', $false); + $this->assertInstanceOf('Doctrine\Tests\Models\Generic\BooleanModel', $false); $this->assertFalse($false->booleanField, "False Boolean Model should be false."); } } \ No newline at end of file diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php index bcf4df543..7f7d3d6cf 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php @@ -16,7 +16,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase // Test initial state $this->assertTrue(count($cm->getReflectionProperties()) == 0); - $this->assertTrue($cm->reflClass instanceof \ReflectionClass); + $this->assertInstanceOf('ReflectionClass', $cm->reflClass); $this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->name); $this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->rootEntityName); $this->assertEquals(array(), $cm->subClasses); @@ -40,7 +40,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->assertInstanceOf('ReflectionClass', $cm->reflClass); $this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->name); $this->assertEquals('UserParent', $cm->rootEntityName); $this->assertEquals(array('Doctrine\Tests\Models\CMS\One', 'Doctrine\Tests\Models\CMS\Two', 'Doctrine\Tests\Models\CMS\Three'), $cm->subClasses); From 1ea3e543ab1729146fe6620c7d6861c2698042f9 Mon Sep 17 00:00:00 2001 From: kwiateusz Date: Tue, 26 Jul 2011 12:10:30 +0200 Subject: [PATCH 06/35] Correted indentation and variable name --- tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php index 4685f1d03..87939ff71 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php @@ -45,7 +45,7 @@ class DDC237Test extends \Doctrine\Tests\OrmFunctionalTestCase $z2 = $this->_em->createQuery('select z,y from ' . get_class($z) . ' z join z.y y where z.id = ?1') ->setParameter(1, $z->id) ->getSingleResult(); - $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $x2->y); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $z2->y); $this->assertTrue($z2->y->__isInitialized__); $this->assertEquals('Y', $z2->y->data); $this->assertEquals($y->id, $z2->y->id); @@ -56,7 +56,7 @@ class DDC237Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertNotSame($x, $x2); $this->assertNotSame($z, $z2); $this->assertSame($z2->y, $x2->y); - $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $x2->y); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $z2->y); } } From 726106090598542b43735d538b0b941e3ed3588b Mon Sep 17 00:00:00 2001 From: kwiateusz Date: Tue, 26 Jul 2011 15:22:57 +0200 Subject: [PATCH 07/35] Few more converts from assertTrue($a instance of $b) to assertInstanceOf --- .../ORM/Functional/BasicFunctionalTest.php | 4 +-- .../Functional/ClassTableInheritanceTest.php | 36 +++++++++---------- .../Functional/ClassTableInheritanceTest2.php | 8 ++--- .../ORM/Functional/DetachedEntityTest.php | 6 ++-- .../ManyToManyBasicAssociationTest.php | 6 ++-- ...ManyToManyBidirectionalAssociationTest.php | 20 +++++------ ...nyToManySelfReferentialAssociationTest.php | 8 ++--- ...anyToManyUnidirectionalAssociationTest.php | 8 ++--- .../Tests/ORM/Functional/NativeQueryTest.php | 22 ++++++------ .../OneToManyBidirectionalAssociationTest.php | 20 +++++------ ...neToManySelfReferentialAssociationTest.php | 8 ++--- .../OneToOneBidirectionalAssociationTest.php | 12 +++---- ...OneToOneSelfReferentialAssociationTest.php | 6 ++-- .../Tests/ORM/Functional/QueryTest.php | 8 ++--- .../ORM/Functional/Ticket/DDC168Test.php | 4 +-- .../ORM/Functional/Ticket/DDC199Test.php | 6 ++-- .../ORM/Functional/Ticket/DDC512Test.php | 8 ++--- .../ORM/Functional/Ticket/DDC522Test.php | 8 ++--- .../ORM/Functional/Ticket/DDC531Test.php | 4 +-- .../Tests/ORM/Functional/Ticket/Ticket69.php | 4 +-- .../ORM/Hydration/CustomHydratorTest.php | 2 +- 21 files changed, 104 insertions(+), 104 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php b/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php index f69b3f862..d94aa253d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php @@ -46,7 +46,7 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->flush(); $this->assertTrue($this->_em->contains($ph)); $this->assertTrue($this->_em->contains($user)); - //$this->assertTrue($user->phonenumbers instanceof \Doctrine\ORM\PersistentCollection); + //$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $user->phonenumbers); // Update name $user->name = 'guilherme'; @@ -92,7 +92,7 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->persist($user); $this->_em->flush(); - //$this->assertTrue($user->phonenumbers instanceof \Doctrine\ORM\PersistentCollection); + //$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $user->phonenumbers); // Remove the first element from the collection unset($user->phonenumbers[0]); diff --git a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php index 0fbff503e..3456d4ba0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php @@ -50,8 +50,8 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $entities = $query->getResult(); $this->assertEquals(2, count($entities)); - $this->assertTrue($entities[0] instanceof CompanyPerson); - $this->assertTrue($entities[1] instanceof CompanyEmployee); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyPerson', $entities[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $entities[1]); $this->assertTrue(is_numeric($entities[0]->getId())); $this->assertTrue(is_numeric($entities[1]->getId())); $this->assertEquals('Roman S. Borschel', $entities[0]->getName()); @@ -65,7 +65,7 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $entities = $query->getResult(); $this->assertEquals(1, count($entities)); - $this->assertTrue($entities[0] instanceof CompanyEmployee); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $entities[0]); $this->assertTrue(is_numeric($entities[0]->getId())); $this->assertEquals('Guilherme Blanco', $entities[0]->getName()); $this->assertEquals(100000, $entities[0]->getSalary()); @@ -73,7 +73,7 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->clear(); $guilherme = $this->_em->getRepository(get_class($employee))->findOneBy(array('name' => 'Guilherme Blanco')); - $this->assertTrue($guilherme instanceof CompanyEmployee); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $guilherme); $this->assertEquals('Guilherme Blanco', $guilherme->getName()); $this->_em->clear(); @@ -110,7 +110,7 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $manager = $this->_em->find('Doctrine\Tests\Models\Company\CompanyManager', $manager->getId()); - $this->assertTrue($manager instanceof CompanyManager); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyManager', $manager); $this->assertEquals('Roman B.', $manager->getName()); $this->assertEquals(119000, $manager->getSalary()); $this->assertEquals('CEO', $manager->getTitle()); @@ -130,12 +130,12 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $person = $this->_em->find('Doctrine\Tests\Models\Company\CompanyPerson', $manager->getId()); - $this->assertTrue($person instanceof CompanyManager); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyManager', $person); $this->assertEquals('Roman S. Borschel', $person->getName()); $this->assertEquals(100000, $person->getSalary()); $this->assertEquals('CTO', $person->getTitle()); $this->assertTrue(is_numeric($person->getId())); - //$this->assertTrue($person->getCar() instanceof CompanyCar); + //$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyCar', $person->getCar()); } public function testSelfReferencingOneToOne() { @@ -167,9 +167,9 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $result = $query->getResult(); $this->assertEquals(1, count($result)); - $this->assertTrue($result[0] instanceof CompanyPerson); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyPerson', $result[0]); $this->assertEquals('Mary Smith', $result[0]->getName()); - $this->assertTrue($result[0]->getSpouse() instanceof CompanyEmployee); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $result[0]->getSpouse()); $this->assertEquals('John Smith', $result[0]->getSpouse()->getName()); $this->assertSame($result[0], $result[0]->getSpouse()->getSpouse()); } @@ -229,20 +229,20 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $result = $q->getResult(); $this->assertEquals(1, count($result)); - $this->assertTrue($result[0] instanceof CompanyOrganization); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyOrganization', $result[0]); $this->assertNull($result[0]->getMainEvent()); $events = $result[0]->getEvents(); - $this->assertTrue($events instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $events); $this->assertFalse($events->isInitialized()); $this->assertEquals(2, count($events)); if ($events[0] instanceof CompanyAuction) { - $this->assertTrue($events[1] instanceof CompanyRaffle); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyRaffle', $events[1]); } else { - $this->assertTrue($events[0] instanceof CompanyRaffle); - $this->assertTrue($events[1] instanceof CompanyAuction); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyRaffle', $events[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyAuction', $events[1]); } } @@ -263,7 +263,7 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $result = $q->getResult(); $this->assertEquals(1, count($result)); - $this->assertTrue($result[0] instanceof CompanyAuction, sprintf("Is of class %s",get_class($result[0]))); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyAuction', $result[0], sprintf("Is of class %s",get_class($result[0]))); $this->_em->clear(); @@ -273,12 +273,12 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $result = $q->getResult(); $this->assertEquals(1, count($result)); - $this->assertTrue($result[0] instanceof CompanyOrganization); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyOrganization', $result[0]); $mainEvent = $result[0]->getMainEvent(); // mainEvent should have been loaded because it can't be lazy - $this->assertTrue($mainEvent instanceof CompanyAuction); - $this->assertFalse($mainEvent instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyAuction', $mainEvent); + $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $mainEvent); } /** diff --git a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php index d720f5d92..e558f2abb 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php +++ b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php @@ -43,9 +43,9 @@ class ClassTableInheritanceTest2 extends \Doctrine\Tests\OrmFunctionalTestCase $related2 = $this->_em->find('Doctrine\Tests\ORM\Functional\CTIRelated', $relatedId); - $this->assertTrue($related2 instanceof CTIRelated); - $this->assertTrue($related2->getCTIParent() instanceof CTIChild); - $this->assertFalse($related2->getCTIParent() instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\CTIRelated', $related2); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\CTIChild', $related2->getCTIParent()); + $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $related2->getCTIParent()); $this->assertEquals('hello', $related2->getCTIParent()->getData()); $this->assertSame($related2, $related2->getCTIParent()->getRelated()); @@ -69,7 +69,7 @@ class ClassTableInheritanceTest2 extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertFalse($mmrel2->getCTIChildren()->isInitialized()); $this->assertEquals(1, count($mmrel2->getCTIChildren())); $this->assertTrue($mmrel2->getCTIChildren()->isInitialized()); - $this->assertTrue($mmrel2->getCTIChildren()->get(0) instanceof CTIChild); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\CTIChild', $mmrel2->getCTIChildren()->get(0)); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php b/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php index c6509f938..5d7e889ae 100644 --- a/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php @@ -137,14 +137,14 @@ class DetachedEntityTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->clear(); $address2 = $this->_em->find(get_class($address), $address->id); - $this->assertTrue($address2->user instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $address2->user); $this->assertFalse($address2->user->__isInitialized__); $detachedAddress2 = unserialize(serialize($address2)); - $this->assertTrue($detachedAddress2->user instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $detachedAddress2->user); $this->assertFalse($detachedAddress2->user->__isInitialized__); $managedAddress2 = $this->_em->merge($detachedAddress2); - $this->assertTrue($managedAddress2->user instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $managedAddress2->user); $this->assertFalse($managedAddress2->user === $detachedAddress2->user); $this->assertFalse($managedAddress2->user->__isInitialized__); } diff --git a/tests/Doctrine/Tests/ORM/Functional/ManyToManyBasicAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/ManyToManyBasicAssociationTest.php index 5f97717d4..cbdb44104 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ManyToManyBasicAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ManyToManyBasicAssociationTest.php @@ -47,7 +47,7 @@ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCa $result = $query->getResult(); $this->assertEquals(2, $this->_em->getUnitOfWork()->size()); - $this->assertTrue($result[0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0]); $this->assertEquals('Guilherme', $result[0]->name); $this->assertEquals(1, $result[0]->getGroups()->count()); $groups = $result[0]->getGroups(); @@ -56,8 +56,8 @@ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCa $this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_MANAGED, $this->_em->getUnitOfWork()->getEntityState($result[0])); $this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_MANAGED, $this->_em->getUnitOfWork()->getEntityState($groups[0])); - $this->assertTrue($groups instanceof \Doctrine\ORM\PersistentCollection); - $this->assertTrue($groups[0]->getUsers() instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $groups); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $groups[0]->getUsers()); $groups[0]->getUsers()->clear(); $groups->clear(); diff --git a/tests/Doctrine/Tests/ORM/Functional/ManyToManyBidirectionalAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/ManyToManyBidirectionalAssociationTest.php index 5a6a2dd50..f8228d7ad 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ManyToManyBidirectionalAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ManyToManyBidirectionalAssociationTest.php @@ -117,8 +117,8 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati //$query->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true); $result = $query->getResult(); $this->assertEquals(2, count($result)); - $this->assertTrue($result[0] instanceof ECommerceCategory); - $this->assertTrue($result[1] instanceof ECommerceCategory); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $result[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $result[1]); $prods1 = $result[0]->getProducts(); $prods2 = $result[1]->getProducts(); $this->assertTrue($prods1->isInitialized()); @@ -157,10 +157,10 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati $this->assertEquals(2, count($secondCategoryProducts)); // lazy-load $this->assertTrue($secondCategoryProducts->isInitialized()); - $this->assertTrue($firstCategoryProducts[0] instanceof ECommerceProduct); - $this->assertTrue($firstCategoryProducts[1] instanceof ECommerceProduct); - $this->assertTrue($secondCategoryProducts[0] instanceof ECommerceProduct); - $this->assertTrue($secondCategoryProducts[1] instanceof ECommerceProduct); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $firstCategoryProducts[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $firstCategoryProducts[1]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $secondCategoryProducts[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $secondCategoryProducts[1]); $this->assertCollectionEquals($firstCategoryProducts, $secondCategoryProducts); } @@ -192,10 +192,10 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati $this->assertEquals(2, count($secondProductCategories)); // lazy-load $this->assertTrue($secondProductCategories->isInitialized()); - $this->assertTrue($firstProductCategories[0] instanceof ECommerceCategory); - $this->assertTrue($firstProductCategories[1] instanceof ECommerceCategory); - $this->assertTrue($secondProductCategories[0] instanceof ECommerceCategory); - $this->assertTrue($secondProductCategories[1] instanceof ECommerceCategory); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $firstProductCategories[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $firstProductCategories[1]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $secondProductCategories[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $secondProductCategories[1]); $this->assertCollectionEquals($firstProductCategories, $secondProductCategories); } diff --git a/tests/Doctrine/Tests/ORM/Functional/ManyToManySelfReferentialAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/ManyToManySelfReferentialAssociationTest.php index 020e77aec..2993825fa 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ManyToManySelfReferentialAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ManyToManySelfReferentialAssociationTest.php @@ -95,10 +95,10 @@ class ManyToManySelfReferentialAssociationTest extends AbstractManyToManyAssocia $this->assertEquals(2, count($firstRelatedBy)); $this->assertEquals(2, count($secondRelatedBy)); - $this->assertTrue($firstRelatedBy[0] instanceof ECommerceProduct); - $this->assertTrue($firstRelatedBy[1] instanceof ECommerceProduct); - $this->assertTrue($secondRelatedBy[0] instanceof ECommerceProduct); - $this->assertTrue($secondRelatedBy[1] instanceof ECommerceProduct); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $firstRelatedBy[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $firstRelatedBy[1]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $secondRelatedBy[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $secondRelatedBy[1]); $this->assertCollectionEquals($firstRelatedBy, $secondRelatedBy); } diff --git a/tests/Doctrine/Tests/ORM/Functional/ManyToManyUnidirectionalAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/ManyToManyUnidirectionalAssociationTest.php index d6c38fc54..7de55e4f0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ManyToManyUnidirectionalAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ManyToManyUnidirectionalAssociationTest.php @@ -69,8 +69,8 @@ class ManyToManyUnidirectionalAssociationTest extends AbstractManyToManyAssociat $products = $firstCart->getProducts(); $secondCart = $result[1]; - $this->assertTrue($products[0] instanceof ECommerceProduct); - $this->assertTrue($products[1] instanceof ECommerceProduct); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $products[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $products[1]); $this->assertCollectionEquals($products, $secondCart->getProducts()); //$this->assertEquals("Doctrine 1.x Manual", $products[0]->getName()); //$this->assertEquals("Doctrine 2.x Manual", $products[1]->getName()); @@ -88,8 +88,8 @@ class ManyToManyUnidirectionalAssociationTest extends AbstractManyToManyAssociat $products = $firstCart->getProducts(); $secondCart = $result[1]; - $this->assertTrue($products[0] instanceof ECommerceProduct); - $this->assertTrue($products[1] instanceof ECommerceProduct); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $products[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $products[1]); $this->assertCollectionEquals($products, $secondCart->getProducts()); } diff --git a/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php b/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php index f997c6c01..d9bda728c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php @@ -49,7 +49,7 @@ class NativeQueryTest extends \Doctrine\Tests\OrmFunctionalTestCase $users = $query->getResult(); $this->assertEquals(1, count($users)); - $this->assertTrue($users[0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]); $this->assertEquals('Roman', $users[0]->name); } @@ -83,9 +83,9 @@ class NativeQueryTest extends \Doctrine\Tests\OrmFunctionalTestCase $users = $query->getResult(); $this->assertEquals(1, count($users)); - $this->assertTrue($users[0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]); $this->assertEquals('Roman', $users[0]->name); - $this->assertTrue($users[0]->getPhonenumbers() instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $users[0]->getPhonenumbers()); $this->assertTrue($users[0]->getPhonenumbers()->isInitialized()); $this->assertEquals(1, count($users[0]->getPhonenumbers())); $phones = $users[0]->getPhonenumbers(); @@ -132,11 +132,11 @@ class NativeQueryTest extends \Doctrine\Tests\OrmFunctionalTestCase $users = $query->getResult(); $this->assertEquals(1, count($users)); - $this->assertTrue($users[0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]); $this->assertEquals('Roman', $users[0]->name); - $this->assertTrue($users[0]->getPhonenumbers() instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $users[0]->getPhonenumbers()); $this->assertFalse($users[0]->getPhonenumbers()->isInitialized()); - $this->assertTrue($users[0]->getAddress() instanceof CmsAddress); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $users[0]->getAddress()); $this->assertTrue($users[0]->getAddress()->getUser() == $users[0]); $this->assertEquals('germany', $users[0]->getAddress()->getCountry()); $this->assertEquals(10827, $users[0]->getAddress()->getZipCode()); @@ -185,9 +185,9 @@ class NativeQueryTest extends \Doctrine\Tests\OrmFunctionalTestCase $users = $query->getResult(); $this->assertEquals(1, count($users)); - $this->assertTrue($users[0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]); $this->assertEquals('Roman', $users[0]->name); - $this->assertTrue($users[0]->getPhonenumbers() instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $users[0]->getPhonenumbers()); $this->assertTrue($users[0]->getPhonenumbers()->isInitialized()); $this->assertEquals(1, count($users[0]->getPhonenumbers())); $phones = $users[0]->getPhonenumbers(); @@ -226,11 +226,11 @@ class NativeQueryTest extends \Doctrine\Tests\OrmFunctionalTestCase $users = $query->getResult(); $this->assertEquals(1, count($users)); - $this->assertTrue($users[0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]); $this->assertEquals('Roman', $users[0]->name); - $this->assertTrue($users[0]->getPhonenumbers() instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $users[0]->getPhonenumbers()); $this->assertFalse($users[0]->getPhonenumbers()->isInitialized()); - $this->assertTrue($users[0]->getAddress() instanceof CmsAddress); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $users[0]->getAddress()); $this->assertTrue($users[0]->getAddress()->getUser() == $users[0]); $this->assertEquals('germany', $users[0]->getAddress()->getCountry()); $this->assertEquals(10827, $users[0]->getAddress()->getZipCode()); diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToManyBidirectionalAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToManyBidirectionalAssociationTest.php index 16a633dde..e39e10b3e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToManyBidirectionalAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToManyBidirectionalAssociationTest.php @@ -77,13 +77,13 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $features = $product->getFeatures(); - $this->assertTrue($features[0] instanceof ECommerceFeature); - $this->assertFalse($features[0]->getProduct() instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceFeature', $features[0]); + $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $features[0]->getProduct()); $this->assertSame($product, $features[0]->getProduct()); $this->assertEquals('Model writing tutorial', $features[0]->getDescription()); - $this->assertTrue($features[1] instanceof ECommerceFeature); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceFeature', $features[1]); $this->assertSame($product, $features[1]->getProduct()); - $this->assertFalse($features[1]->getProduct() instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $features[1]->getProduct()); $this->assertEquals('Annotations examples', $features[1]->getDescription()); } @@ -97,11 +97,11 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $features = $product->getFeatures(); $this->assertFalse($features->isInitialized()); - $this->assertTrue($features[0] instanceof ECommerceFeature); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceFeature', $features[0]); $this->assertTrue($features->isInitialized()); $this->assertSame($product, $features[0]->getProduct()); $this->assertEquals('Model writing tutorial', $features[0]->getDescription()); - $this->assertTrue($features[1] instanceof ECommerceFeature); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceFeature', $features[1]); $this->assertSame($product, $features[1]->getProduct()); $this->assertEquals('Annotations examples', $features[1]->getDescription()); } @@ -114,8 +114,8 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $features = $query->getResult(); $product = $features[0]->getProduct(); - $this->assertTrue($product instanceof \Doctrine\ORM\Proxy\Proxy); - $this->assertTrue($product instanceof ECommerceProduct); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $product); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $product); $this->assertFalse($product->__isInitialized__); $this->assertSame('Doctrine Cookbook', $product->getName()); $this->assertTrue($product->__isInitialized__); @@ -130,8 +130,8 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $features = $query->getResult(); $product = $features[0]->getProduct(); - $this->assertFalse($product instanceof \Doctrine\ORM\Proxy\Proxy); - $this->assertTrue($product instanceof ECommerceProduct); + $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $product); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $product); $this->assertSame('Doctrine Cookbook', $product->getName()); $this->assertFalse($product->getFeatures()->isInitialized()); diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToManySelfReferentialAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToManySelfReferentialAssociationTest.php index 5d6c182ab..e37497658 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToManySelfReferentialAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToManySelfReferentialAssociationTest.php @@ -79,10 +79,10 @@ class OneToManySelfReferentialAssociationTest extends \Doctrine\Tests\OrmFunctio $parent = $result[0]; $children = $parent->getChildren(); - $this->assertTrue($children[0] instanceof ECommerceCategory); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $children[0]); $this->assertSame($parent, $children[0]->getParent()); $this->assertEquals(' books', strstr($children[0]->getName(), ' books')); - $this->assertTrue($children[1] instanceof ECommerceCategory); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $children[1]); $this->assertSame($parent, $children[1]->getParent()); $this->assertEquals(' books', strstr($children[1]->getName(), ' books')); } @@ -98,10 +98,10 @@ class OneToManySelfReferentialAssociationTest extends \Doctrine\Tests\OrmFunctio $parent = $result[0]; $children = $parent->getChildren(); - $this->assertTrue($children[0] instanceof ECommerceCategory); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $children[0]); $this->assertSame($parent, $children[0]->getParent()); $this->assertEquals(' books', strstr($children[0]->getName(), ' books')); - $this->assertTrue($children[1] instanceof ECommerceCategory); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $children[1]); $this->assertSame($parent, $children[1]->getParent()); $this->assertEquals(' books', strstr($children[1]->getName(), ' books')); } diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneBidirectionalAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneBidirectionalAssociationTest.php index 93e30cbc0..75be67e77 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneBidirectionalAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneBidirectionalAssociationTest.php @@ -62,7 +62,7 @@ class OneToOneBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctional $result = $query->getResult(); $customer = $result[0]; - $this->assertTrue($customer->getCart() instanceof ECommerceCart); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCart', $customer->getCart()); $this->assertEquals('paypal', $customer->getCart()->getPayment()); } @@ -75,7 +75,7 @@ class OneToOneBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctional $result = $query->getResult(); $cart = $result[0]; - $this->assertTrue($cart->getCustomer() instanceof ECommerceCustomer); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCustomer', $cart->getCustomer()); $this->assertEquals('Giorgio', $cart->getCustomer()->getName()); } @@ -90,8 +90,8 @@ class OneToOneBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctional $customer = $result[0]; $this->assertNull($customer->getMentor()); - $this->assertTrue($customer->getCart() instanceof ECommerceCart); - $this->assertFalse($customer->getCart() instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOF('Doctrine\Tests\Models\ECommerce\ECommerceCart', $customer->getCart()); + $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $customer->getCart()); $this->assertEquals('paypal', $customer->getCart()->getPayment()); } @@ -107,7 +107,7 @@ class OneToOneBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctional $this->_em->flush(); $this->_em->clear(); - $this->assertTrue($cust->getCart() instanceof ECommerceCart); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCart', $cust->getCart()); $this->assertEquals('Roman', $cust->getName()); $this->assertSame($cust, $cart->getCustomer()); @@ -126,7 +126,7 @@ class OneToOneBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctional $cart3 = $query2->getSingleResult(); - $this->assertTrue($cart3->getCustomer() instanceof ECommerceCustomer); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCustomer', $cart3->getCustomer()); $this->assertEquals('Roman', $cart3->getCustomer()->getName()); } diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneSelfReferentialAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneSelfReferentialAssociationTest.php index d7132ed60..bcd41dcaf 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneSelfReferentialAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneSelfReferentialAssociationTest.php @@ -104,8 +104,8 @@ class OneToOneSelfReferentialAssociationTest extends \Doctrine\Tests\OrmFunction $entity2 = $this->_em->find(get_class($entity1), $entity1->getId()); - $this->assertTrue($entity2->getOther1() instanceof MultiSelfReference); - $this->assertTrue($entity2->getOther2() instanceof MultiSelfReference); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\MultiSelfReference', $entity2->getOther1()); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\MultiSelfReference', $entity2->getOther2()); $this->assertNull($entity2->getOther1()->getOther1()); $this->assertNull($entity2->getOther1()->getOther2()); $this->assertNull($entity2->getOther2()->getOther1()); @@ -114,7 +114,7 @@ class OneToOneSelfReferentialAssociationTest extends \Doctrine\Tests\OrmFunction public function assertLoadingOfAssociation($customer) { - $this->assertTrue($customer->getMentor() instanceof ECommerceCustomer); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCustomer', $customer->getMentor()); $this->assertEquals('Obi-wan Kenobi', $customer->getMentor()->getName()); } diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryTest.php index d8937289a..82180a4ed 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryTest.php @@ -38,7 +38,7 @@ class QueryTest extends \Doctrine\Tests\OrmFunctionalTestCase $result = $query->getResult(); $this->assertEquals(1, count($result)); - $this->assertTrue($result[0][0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0][0]); $this->assertEquals('Guilherme', $result[0][0]->name); $this->assertEquals('gblanco', $result[0][0]->username); $this->assertEquals('developer', $result[0][0]->status); @@ -90,7 +90,7 @@ class QueryTest extends \Doctrine\Tests\OrmFunctionalTestCase $query = $this->_em->createQuery("select u, a from Doctrine\Tests\Models\CMS\CmsUser u join u.articles a"); $users = $query->getResult(); $this->assertEquals(1, count($users)); - $this->assertTrue($users[0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]); $this->assertEquals(2, count($users[0]->articles)); $this->assertEquals('Doctrine 2', $users[0]->articles[0]->topic); $this->assertEquals('Symfony 2', $users[0]->articles[1]->topic); @@ -361,9 +361,9 @@ class QueryTest extends \Doctrine\Tests\OrmFunctionalTestCase $result = $q->getResult(); $this->assertEquals(1, count($result)); - $this->assertTrue($result[0] instanceof CmsArticle); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsArticle', $result[0]); $this->assertEquals("dr. dolittle", $result[0]->topic); - $this->assertTrue($result[0]->user instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $result[0]->user); $this->assertFalse($result[0]->user->__isInitialized__); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC168Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC168Test.php index 41c41df45..004acfa8c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC168Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC168Test.php @@ -58,7 +58,7 @@ class DDC168Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertEquals("bar", $theEmployee->getDepartment()); $this->assertEquals("Foo", $theEmployee->getName()); $this->assertEquals(1000, $theEmployee->getSalary()); - $this->assertTrue($theEmployee instanceof CompanyEmployee); - $this->assertTrue($theEmployee->getSpouse() instanceof CompanyEmployee); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $theEmployee); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $theEmployee->getSpouse()); } } \ No newline at end of file diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php index e912c389f..8b5eddbf8 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php @@ -40,11 +40,11 @@ class DDC199Test extends \Doctrine\Tests\OrmFunctionalTestCase $result = $query->getResult(); $this->assertEquals(1, count($result)); - $this->assertTrue($result[0] instanceof DDC199ChildClass); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC199ParentClass', $result[0]); $this->assertTrue($result[0]->relatedEntities->isInitialized()); $this->assertEquals(2, $result[0]->relatedEntities->count()); - $this->assertTrue($result[0]->relatedEntities[0] instanceof DDC199RelatedClass); - $this->assertTrue($result[0]->relatedEntities[1] instanceof DDC199RelatedClass); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC199RelatedClass', $result[0]->relatedEntities[0]); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC199RelatedClass', $result[0]->relatedEntities[1]); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php index 72b11aaab..b9c74d399 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php @@ -32,14 +32,14 @@ class DDC512Test extends \Doctrine\Tests\OrmFunctionalTestCase $result = $q->getResult(); $this->assertEquals(2, count($result)); - $this->assertTrue($result[0] instanceof DDC512Customer); - $this->assertTrue($result[1] instanceof DDC512Customer); + $this->assertInstanceOf(__NAMESPACE__ . '\DDC512Customer', $result[0]); + $this->assertInstanceOf(__NAMESPACE__ . '\DDC512Customer', $result[1]); if ($result[0]->id == $customer1->id) { - $this->assertTrue($result[0]->item instanceof DDC512OfferItem); + $this->assertInstanceOf(__NAMESPACE__ . '\DDC512OfferItem', $result[0]->item); $this->assertEquals($item->id, $result[0]->item->id); $this->assertNull($result[1]->item); } else { - $this->assertTrue($result[1]->item instanceof DDC512OfferItem); + $this->assertInstanceOf(__NAMESPACE__ . '\DDC512OfferItem', $result[1]->item); $this->assertNull($result[0]->item); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php index d0e8f4c7d..c517d461e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php @@ -48,9 +48,9 @@ class DDC522Test extends \Doctrine\Tests\OrmFunctionalTestCase $r = $this->_em->createQuery("select ca,c from ".get_class($cart)." ca join ca.customer c") ->getResult(); - $this->assertTrue($r[0] instanceof DDC522Cart); - $this->assertTrue($r[0]->customer instanceof DDC522Customer); - $this->assertFalse($r[0]->customer instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf(__NAMESPACE__ . '\DDC522Cart', $r[0]); + $this->assertInstanceOf(__NAMESPACE__ . '\DDC522Customer', $r[0]->customer); + $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $r[0]->customer); $this->assertEquals('name', $r[0]->customer->name); $fkt = new DDC522ForeignKeyTest(); @@ -62,7 +62,7 @@ class DDC522Test extends \Doctrine\Tests\OrmFunctionalTestCase $fkt2 = $this->_em->find(get_class($fkt), $fkt->id); $this->assertEquals($fkt->cart->id, $fkt2->cartId); - $this->assertTrue($fkt2->cart instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $fkt2->cart); $this->assertFalse($fkt2->cart->__isInitialized__); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php index 0ac3b9b8d..7ce19cfab 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php @@ -29,8 +29,8 @@ class DDC531Test extends \Doctrine\Tests\OrmFunctionalTestCase $item3 = $this->_em->find(__NAMESPACE__ . '\DDC531Item', $item2->id); // Load child item first (id 2) // parent will already be loaded, cannot be lazy because it has mapped subclasses and we would not // know which proxy type to put in. - $this->assertTrue($item3->parent instanceof DDC531Item); - $this->assertFalse($item3->parent instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf(__NAMESPACE__ . '\DDC531Item', $item3->parent); + $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $item3->parent); $item4 = $this->_em->find(__NAMESPACE__ . '\DDC531Item', $item1->id); // Load parent item (id 1) $this->assertNull($item4->parent); $this->assertNotNull($item4->getChildren()); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php index f6ef6c3bf..759a593fd 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php @@ -85,11 +85,11 @@ class AdvancedAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCase { $lemma = $res[0]; $this->assertEquals('foo', $lemma->getLemma()); - $this->assertTrue($lemma instanceof Lemma); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\Lemma', $lemma); $relations = $lemma->getRelations(); foreach($relations as $relation) { - $this->assertTrue($relation instanceof Relation); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\Relation', $relation); $this->assertTrue($relation->getType()->getType() != ''); } diff --git a/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php b/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php index 6b5e45149..8daf961b5 100644 --- a/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php +++ b/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php @@ -15,7 +15,7 @@ class CustomHydratorTest extends HydrationTestCase $config->addCustomHydrationMode('CustomHydrator', 'Doctrine\Tests\ORM\Hydration\CustomHydrator'); $hydrator = $em->newHydrator('CustomHydrator'); - $this->assertTrue($hydrator instanceof \Doctrine\Tests\ORM\Hydration\CustomHydrator); + $this->assertInstanceOf('Doctrine\Tests\ORM\Hydration\CustomHydrator', $hydrator); $this->assertNull($config->getCustomHydrationMode('does not exist')); } } From a99ffc126f3ec3fa45fa806bfdba4fc31f1afaa4 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Tue, 26 Jul 2011 22:15:27 +0200 Subject: [PATCH 08/35] DDC-1276 - Fix bug where merge managed and new entitiy share the same collection that is cascaded, cleared during the process and then empty afterwards. --- lib/Doctrine/ORM/UnitOfWork.php | 7 ++- .../ORM/Functional/Ticket/DDC1276Test.php | 50 +++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1276Test.php diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index 684210272..d62eb62c7 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -1456,7 +1456,8 @@ class UnitOfWork implements PropertyChangedListener } if ($assoc2['isCascadeMerge']) { $managedCol->initialize(); - if (!$managedCol->isEmpty()) { + // clear and set dirty a managed collection if its not also the same collection to merge from. + if (!$managedCol->isEmpty() && $managedCol != $mergeCol) { $managedCol->unwrap()->clear(); $managedCol->setDirty(true); if ($assoc2['isOwningSide'] && $assoc2['type'] == ClassMetadata::MANY_TO_MANY && $class->isChangeTrackingNotify()) { @@ -1655,6 +1656,10 @@ class UnitOfWork implements PropertyChangedListener } $relatedEntities = $class->reflFields[$assoc['fieldName']]->getValue($entity); if ($relatedEntities instanceof Collection) { + if ($relatedEntities === $class->reflFields[$assoc['fieldName']]->getValue($managedCopy)) { + continue; + } + if ($relatedEntities instanceof PersistentCollection) { // Unwrap so that foreach() does not initialize $relatedEntities = $relatedEntities->unwrap(); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1276Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1276Test.php new file mode 100644 index 000000000..1b9dc8c99 --- /dev/null +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1276Test.php @@ -0,0 +1,50 @@ +useModelSet('cms'); + parent::setUp(); + } + + public function testIssue() + { + $user = new CmsUser(); + $user->name = "Benjamin"; + $user->username = "beberlei"; + $user->status = "active"; + $this->_em->persist($user); + + for ($i = 0; $i < 2; $i++) { + $group = new CmsGroup(); + $group->name = "group".$i; + $user->groups[] = $group; + $this->_em->persist($group); + } + $this->_em->flush(); + $this->_em->clear(); + + $user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $user->id); + $cloned = clone $user; + + $this->assertSame($user->groups, $cloned->groups); + $this->assertEquals(2, count($user->groups)); + $this->_em->merge($cloned); + + $this->assertEquals(2, count($user->groups)); + + $this->_em->flush(); + } +} \ No newline at end of file From cbf210605a80da33dd0090ba488118102b518359 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Tue, 26 Jul 2011 22:24:16 +0200 Subject: [PATCH 09/35] [DDC-1290] Allow smallint and bigint for version fields --- lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index 7c5cf8d26..a707577d7 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -1800,7 +1800,7 @@ class ClassMetadataInfo implements ClassMetadata $this->versionField = $mapping['fieldName']; if ( ! isset($mapping['default'])) { - if ($mapping['type'] == 'integer') { + if (in_array($mapping['type'], array('integer', 'bigint', 'smallint'))) { $mapping['default'] = 1; } else if ($mapping['type'] == 'datetime') { $mapping['default'] = 'CURRENT_TIMESTAMP'; From 93d2e1bd0ab43c631301a32f88b04d61ca2b458e Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Tue, 26 Jul 2011 22:30:20 +0200 Subject: [PATCH 10/35] [DDC-1280] Only generate linefeeds in proxies for consistency. --- lib/Doctrine/ORM/Proxy/ProxyFactory.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/ORM/Proxy/ProxyFactory.php b/lib/Doctrine/ORM/Proxy/ProxyFactory.php index 90a3a8d5b..8d62ca7ab 100644 --- a/lib/Doctrine/ORM/Proxy/ProxyFactory.php +++ b/lib/Doctrine/ORM/Proxy/ProxyFactory.php @@ -172,7 +172,7 @@ class ProxyFactory } if ($method->isPublic() && ! $method->isFinal() && ! $method->isStatic()) { - $methods .= PHP_EOL . ' public function '; + $methods .= "\n" . ' public function '; if ($method->returnsReference()) { $methods .= '&'; } @@ -208,10 +208,10 @@ class ProxyFactory } $methods .= $parameterString . ')'; - $methods .= PHP_EOL . ' {' . PHP_EOL; - $methods .= ' $this->__load();' . PHP_EOL; + $methods .= "\n" . ' {' . "\n"; + $methods .= ' $this->__load();' . "\n"; $methods .= ' return parent::' . $method->getName() . '(' . $argumentString . ');'; - $methods .= PHP_EOL . ' }' . PHP_EOL; + $methods .= "\n" . ' }' . "\n"; } } From 598ab36968007d24b420f6eb59011edae48dc389 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Tue, 26 Jul 2011 22:59:55 +0200 Subject: [PATCH 11/35] [DDC-1215] Fix EntityGenerator inheritance regenerating properties and methods --- lib/Doctrine/ORM/Tools/EntityGenerator.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index f55af76b1..c0e7b6267 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -462,6 +462,14 @@ public function () private function _hasProperty($property, ClassMetadataInfo $metadata) { + if ($this->_extendsClass()) { + // don't generate property if its already on the base class. + $reflClass = new \ReflectionClass($this->_getClassToExtend()); + if ($reflClass->hasProperty($property)) { + return true; + } + } + return ( isset($this->_staticReflection[$metadata->name]) && in_array($property, $this->_staticReflection[$metadata->name]['properties']) @@ -470,6 +478,14 @@ public function () private function _hasMethod($method, ClassMetadataInfo $metadata) { + if ($this->_extendsClass()) { + // don't generate method if its already on the base class. + $reflClass = new \ReflectionClass($this->_getClassToExtend()); + if ($reflClass->hasMethod($method)) { + return true; + } + } + return ( isset($this->_staticReflection[$metadata->name]) && in_array($method, $this->_staticReflection[$metadata->name]['methods']) From a0b7c3e76ddcae433c28c2e71fa2e4dbafa648fa Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Tue, 26 Jul 2011 23:16:38 +0200 Subject: [PATCH 12/35] Add UPGRADE_TO_2_2 file --- UPGRADE_TO_2_2 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 UPGRADE_TO_2_2 diff --git a/UPGRADE_TO_2_2 b/UPGRADE_TO_2_2 new file mode 100644 index 000000000..0500e4599 --- /dev/null +++ b/UPGRADE_TO_2_2 @@ -0,0 +1,3 @@ +# Removed support for onUpdate in @JoinColumn + +The onUpdate foreign key handling makes absolutly no sense in an ORM. Additionally Oracle doesn't even support it. Support for it is removed. From 154fd60d850bf8feb2ff3c6976cd86972c63a2ea Mon Sep 17 00:00:00 2001 From: Michael Ridgway Date: Tue, 26 Jul 2011 17:35:06 -0400 Subject: [PATCH 13/35] DDC-1275: Added join columns to result set mapping --- .../ORM/Query/ResultSetMappingBuilder.php | 19 ++++++ .../Tests/ORM/Functional/NativeQueryTest.php | 67 +++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php b/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php index ceacc9638..95d548daf 100644 --- a/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php +++ b/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php @@ -67,6 +67,7 @@ class ResultSetMappingBuilder extends ResultSetMapping } $this->addFieldResult($alias, $platform->getSQLResultCasing($columnName), $propertyName); } + $this->addAssocationMappings($alias, $classMetadata->getAssociationMappings()); } /** @@ -96,5 +97,23 @@ class ResultSetMappingBuilder extends ResultSetMapping } $this->addFieldResult($alias, $platform->getSQLResultCasing($columnName), $propertyName); } + $this->addAssocationMappings($alias, $classMetadata->getAssociationMappings()); + } + + protected function addAssocationMappings($alias, $associationMappings) + { + $platform = $this->em->getConnection()->getDatabasePlatform(); + foreach ($associationMappings AS $associationMapping) { + if (isset($associationMapping['joinColumns'])) { + foreach ($associationMapping['joinColumns'] AS $joinColumn) { + $columnName = $joinColumn['name']; + $renamedColumnName = isset($renamedColumns[$columnName]) ? $renamedColumns[$columnName] : $columnName; + if (isset($this->metaMappings[$renamedColumnName])) { + throw new \InvalidArgumentException("The column '$renamedColumnName' conflicts with another column in the mapper."); + } + $this->addMetaResult($alias, $platform->getSQLResultCasing($renamedColumnName), $platform->getSQLResultCasing($columnName)); + } + } + } } } \ No newline at end of file diff --git a/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php b/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php index f997c6c01..c8347d66d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php @@ -52,6 +52,48 @@ class NativeQueryTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertTrue($users[0] instanceof CmsUser); $this->assertEquals('Roman', $users[0]->name); } + + public function testBasicNativeQueryWithMetaResult() + { + $user = new CmsUser; + $user->name = 'Roman'; + $user->username = 'romanb'; + $user->status = 'dev'; + + $addr = new CmsAddress; + $addr->country = 'germany'; + $addr->zip = 10827; + $addr->city = 'Berlin'; + + + $user->setAddress($addr); + + $this->_em->persist($user); + $this->_em->flush(); + + $this->_em->clear(); + + $rsm = new ResultSetMapping; + $rsm->addEntityResult('Doctrine\Tests\Models\CMS\CmsAddress', 'a'); + $rsm->addFieldResult('a', $this->platform->getSQLResultCasing('id'), 'id'); + $rsm->addFieldResult('a', $this->platform->getSQLResultCasing('country'), 'country'); + $rsm->addFieldResult('a', $this->platform->getSQLResultCasing('zip'), 'zip'); + $rsm->addFieldResult('a', $this->platform->getSQLResultCasing('city'), 'city'); + $rsm->addMetaResult('a', $this->platform->getSQLResultCasing('user_id'), 'user_id'); + + $query = $this->_em->createNativeQuery('SELECT a.id, a.country, a.zip, a.city, a.user_id FROM cms_addresses a WHERE a.id = ?', $rsm); + $query->setParameter(1, $addr->id); + + $addresses = $query->getResult(); + + $this->assertEquals(1, count($addresses)); + $this->assertTrue($addresses[0] instanceof CmsAddress); + $this->assertEquals($addr->country, $addresses[0]->country); + $this->assertEquals($addr->zip, $addresses[0]->zip); + $this->assertEquals($addr->city, $addresses[0]->city); + $this->assertEquals($addr->street, $addresses[0]->street); + $this->assertTrue($addresses[0]->user instanceof CmsUser); + } public function testJoinedOneToManyNativeQuery() { @@ -193,6 +235,20 @@ class NativeQueryTest extends \Doctrine\Tests\OrmFunctionalTestCase $phones = $users[0]->getPhonenumbers(); $this->assertEquals(424242, $phones[0]->phonenumber); $this->assertTrue($phones[0]->getUser() === $users[0]); + + $this->_em->clear(); + + $rsm = new ResultSetMappingBuilder($this->_em); + $rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsPhonenumber', 'p'); + $query = $this->_em->createNativeQuery('SELECT p.* FROM cms_phonenumbers p WHERE p.phonenumber = ?', $rsm); + $query->setParameter(1, $phone->phonenumber); + $phone = $query->getSingleResult(); + +// \Doctrine\Common\Util\Debug::dump($phone); +// die(); + + $this->assertNotNull($phone->getUser()); + $this->assertEquals($user->name, $phone->getUser()->getName()); } public function testJoinedOneToOneNativeQueryWithRSMBuilder() @@ -235,6 +291,17 @@ class NativeQueryTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertEquals('germany', $users[0]->getAddress()->getCountry()); $this->assertEquals(10827, $users[0]->getAddress()->getZipCode()); $this->assertEquals('Berlin', $users[0]->getAddress()->getCity()); + + $this->_em->clear(); + + $rsm = new ResultSetMappingBuilder($this->_em); + $rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress', 'a'); + $query = $this->_em->createNativeQuery('SELECT a.* FROM cms_addresses a WHERE a.id = ?', $rsm); + $query->setParameter(1, $addr->getId()); + $address = $query->getSingleResult(); + + $this->assertNotNull($address->getUser()); + $this->assertEquals($user->name, $address->getUser()->getName()); } /** From 7f20a32db31d3d0e7b288b4e5c358a3f0334c4c0 Mon Sep 17 00:00:00 2001 From: Michael Ridgway Date: Tue, 26 Jul 2011 17:39:57 -0400 Subject: [PATCH 14/35] Removing debug comment --- tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php b/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php index c8347d66d..a8d5873f7 100644 --- a/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php @@ -244,9 +244,6 @@ class NativeQueryTest extends \Doctrine\Tests\OrmFunctionalTestCase $query->setParameter(1, $phone->phonenumber); $phone = $query->getSingleResult(); -// \Doctrine\Common\Util\Debug::dump($phone); -// die(); - $this->assertNotNull($phone->getUser()); $this->assertEquals($user->name, $phone->getUser()->getName()); } From a47af43bc1006178c65ba41052e4aa2b2099fa50 Mon Sep 17 00:00:00 2001 From: kwiateusz Date: Wed, 27 Jul 2011 08:54:06 +0200 Subject: [PATCH 15/35] Last change from assertTrue($a instanceof $b) to assertInstanceOf --- .../ORM/Hydration/ObjectHydratorTest.php | 110 +++++++++--------- .../Tests/ORM/Mapping/ClassMetadataTest.php | 2 +- .../AbstractClassMetadataExporterTest.php | 6 +- 3 files changed, 59 insertions(+), 59 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Hydration/ObjectHydratorTest.php b/tests/Doctrine/Tests/ORM/Hydration/ObjectHydratorTest.php index ecd50f237..f2673ac70 100644 --- a/tests/Doctrine/Tests/ORM/Hydration/ObjectHydratorTest.php +++ b/tests/Doctrine/Tests/ORM/Hydration/ObjectHydratorTest.php @@ -44,8 +44,8 @@ class ObjectHydratorTest extends HydrationTestCase $result = $hydrator->hydrateAll($stmt, $rsm, array(Query::HINT_FORCE_PARTIAL_LOAD => true)); $this->assertEquals(2, count($result)); - $this->assertTrue($result[0] instanceof \Doctrine\Tests\Models\CMS\CmsUser); - $this->assertTrue($result[1] instanceof \Doctrine\Tests\Models\CMS\CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[1]); $this->assertEquals(1, $result[0]->id); $this->assertEquals('romanb', $result[0]->name); $this->assertEquals(2, $result[1]->id); @@ -116,10 +116,10 @@ class ObjectHydratorTest extends HydrationTestCase $this->assertEquals(4, count($result)); - $this->assertTrue($result[0] instanceof \Doctrine\Tests\Models\CMS\CmsUser); - $this->assertTrue($result[1] instanceof \Doctrine\Tests\Models\CMS\CmsArticle); - $this->assertTrue($result[2] instanceof \Doctrine\Tests\Models\CMS\CmsUser); - $this->assertTrue($result[3] instanceof \Doctrine\Tests\Models\CMS\CmsArticle); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsArticle', $result[1]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[2]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsArticle', $result[3]); $this->assertEquals(1, $result[0]->id); $this->assertEquals('romanb', $result[0]->name); @@ -173,7 +173,7 @@ class ObjectHydratorTest extends HydrationTestCase $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(1, count($result)); - $this->assertTrue($result[0] instanceof \Doctrine\Tests\Models\ECommerce\ECommerceProduct); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $result[0]); } /** @@ -231,12 +231,12 @@ class ObjectHydratorTest extends HydrationTestCase $this->assertTrue(is_array($result[0])); $this->assertTrue(is_array($result[1])); - $this->assertTrue($result[0][0] instanceof \Doctrine\Tests\Models\CMS\CmsUser); - $this->assertTrue($result[0][0]->phonenumbers instanceof \Doctrine\ORM\PersistentCollection); - $this->assertTrue($result[0][0]->phonenumbers[0] instanceof \Doctrine\Tests\Models\CMS\CmsPhonenumber); - $this->assertTrue($result[0][0]->phonenumbers[1] instanceof \Doctrine\Tests\Models\CMS\CmsPhonenumber); - $this->assertTrue($result[1][0] instanceof \Doctrine\Tests\Models\CMS\CmsUser); - $this->assertTrue($result[1][0]->phonenumbers instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0][0]); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $result[0][0]->phonenumbers); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsPhonenumber', $result[0][0]->phonenumbers[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsPhonenumber', $result[0][0]->phonenumbers[1]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[1][0]); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $result[1][0]->phonenumbers); // first user => 2 phonenumbers $this->assertEquals(2, count($result[0][0]->phonenumbers)); @@ -293,8 +293,8 @@ class ObjectHydratorTest extends HydrationTestCase $this->assertEquals(2, $result[0]['numPhones']); // second user => 1 phonenumber $this->assertEquals(1, $result[1]['numPhones']); - $this->assertTrue($result[0][0] instanceof \Doctrine\Tests\Models\CMS\CmsUser); - $this->assertTrue($result[1][0] instanceof \Doctrine\Tests\Models\CMS\CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0][0]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[1][0]); } /** @@ -359,9 +359,9 @@ class ObjectHydratorTest extends HydrationTestCase $this->assertEquals('ROMANB', $result[0]['nameUpper']); $this->assertEquals('JWAGE', $result[1]['nameUpper']); - $this->assertTrue($result[0]['1'] instanceof \Doctrine\Tests\Models\CMS\CmsUser); - $this->assertTrue($result[1]['2'] instanceof \Doctrine\Tests\Models\CMS\CmsUser); - $this->assertTrue($result[0]['1']->phonenumbers instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0]['1']); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[1]['2']); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $result[0]['1']->phonenumbers); // first user => 2 phonenumbers. notice the custom indexing by user id $this->assertEquals(2, count($result[0]['1']->phonenumbers)); // second user => 1 phonenumber. notice the custom indexing by user id @@ -469,18 +469,18 @@ class ObjectHydratorTest extends HydrationTestCase $this->assertTrue(is_array($result[0])); $this->assertTrue(is_array($result[1])); - $this->assertTrue($result[0][0] instanceof \Doctrine\Tests\Models\CMS\CmsUser); - $this->assertTrue($result[0][0]->phonenumbers instanceof \Doctrine\ORM\PersistentCollection); - $this->assertTrue($result[0][0]->phonenumbers[0] instanceof \Doctrine\Tests\Models\CMS\CmsPhonenumber); - $this->assertTrue($result[0][0]->phonenumbers[1] instanceof \Doctrine\Tests\Models\CMS\CmsPhonenumber); - $this->assertTrue($result[0][0]->articles instanceof \Doctrine\ORM\PersistentCollection); - $this->assertTrue($result[0][0]->articles[0] instanceof \Doctrine\Tests\Models\CMS\CmsArticle); - $this->assertTrue($result[0][0]->articles[1] instanceof \Doctrine\Tests\Models\CMS\CmsArticle); - $this->assertTrue($result[1][0] instanceof \Doctrine\Tests\Models\CMS\CmsUser); - $this->assertTrue($result[1][0]->phonenumbers instanceof \Doctrine\ORM\PersistentCollection); - $this->assertTrue($result[1][0]->phonenumbers[0] instanceof \Doctrine\Tests\Models\CMS\CmsPhonenumber); - $this->assertTrue($result[1][0]->articles[0] instanceof \Doctrine\Tests\Models\CMS\CmsArticle); - $this->assertTrue($result[1][0]->articles[1] instanceof \Doctrine\Tests\Models\CMS\CmsArticle); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0][0]); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $result[0][0]->phonenumbers); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsPhonenumber', $result[0][0]->phonenumbers[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsPhonenumber', $result[0][0]->phonenumbers[1]); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $result[0][0]->articles); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsArticle', $result[0][0]->articles[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsArticle', $result[0][0]->articles[1]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[1][0]); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $result[1][0]->phonenumbers); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsPhonenumber', $result[1][0]->phonenumbers[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsArticle', $result[1][0]->articles[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsArticle', $result[1][0]->articles[1]); } /** @@ -604,29 +604,29 @@ class ObjectHydratorTest extends HydrationTestCase $this->assertTrue(is_array($result[0])); $this->assertTrue(is_array($result[1])); - $this->assertTrue($result[0][0] instanceof \Doctrine\Tests\Models\CMS\CmsUser); - $this->assertTrue($result[1][0] instanceof \Doctrine\Tests\Models\CMS\CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0][0]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[1][0]); // phonenumbers - $this->assertTrue($result[0][0]->phonenumbers instanceof \Doctrine\ORM\PersistentCollection); - $this->assertTrue($result[0][0]->phonenumbers[0] instanceof \Doctrine\Tests\Models\CMS\CmsPhonenumber); - $this->assertTrue($result[0][0]->phonenumbers[1] instanceof \Doctrine\Tests\Models\CMS\CmsPhonenumber); - $this->assertTrue($result[1][0]->phonenumbers instanceof \Doctrine\ORM\PersistentCollection); - $this->assertTrue($result[1][0]->phonenumbers[0] instanceof \Doctrine\Tests\Models\CMS\CmsPhonenumber); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $result[0][0]->phonenumbers); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsPhonenumber', $result[0][0]->phonenumbers[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsPhonenumber', $result[0][0]->phonenumbers[1]); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $result[1][0]->phonenumbers); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsPhonenumber', $result[1][0]->phonenumbers[0]); // articles - $this->assertTrue($result[0][0]->articles instanceof \Doctrine\ORM\PersistentCollection); - $this->assertTrue($result[0][0]->articles[0] instanceof \Doctrine\Tests\Models\CMS\CmsArticle); - $this->assertTrue($result[0][0]->articles[1] instanceof \Doctrine\Tests\Models\CMS\CmsArticle); - $this->assertTrue($result[1][0]->articles[0] instanceof \Doctrine\Tests\Models\CMS\CmsArticle); - $this->assertTrue($result[1][0]->articles[1] instanceof \Doctrine\Tests\Models\CMS\CmsArticle); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $result[0][0]->articles); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsArticle', $result[0][0]->articles[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsArticle', $result[0][0]->articles[1]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsArticle', $result[1][0]->articles[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsArticle', $result[1][0]->articles[1]); // article comments - $this->assertTrue($result[0][0]->articles[0]->comments instanceof \Doctrine\ORM\PersistentCollection); - $this->assertTrue($result[0][0]->articles[0]->comments[0] instanceof \Doctrine\Tests\Models\CMS\CmsComment); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $result[0][0]->articles[0]->comments); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsComment', $result[0][0]->articles[0]->comments[0]); // empty comment collections - $this->assertTrue($result[0][0]->articles[1]->comments instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $result[0][0]->articles[1]->comments); $this->assertEquals(0, count($result[0][0]->articles[1]->comments)); - $this->assertTrue($result[1][0]->articles[0]->comments instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $result[1][0]->articles[0]->comments); $this->assertEquals(0, count($result[1][0]->articles[0]->comments)); - $this->assertTrue($result[1][0]->articles[1]->comments instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $result[1][0]->articles[1]->comments); $this->assertEquals(0, count($result[1][0]->articles[1]->comments)); } @@ -706,8 +706,8 @@ class ObjectHydratorTest extends HydrationTestCase $result = $hydrator->hydrateAll($stmt, $rsm, array(Query::HINT_FORCE_PARTIAL_LOAD => true)); $this->assertEquals(2, count($result)); - $this->assertTrue($result[0] instanceof \Doctrine\Tests\Models\Forum\ForumCategory); - $this->assertTrue($result[1] instanceof \Doctrine\Tests\Models\Forum\ForumCategory); + $this->assertInstanceOf('Doctrine\Tests\Models\Forum\ForumCategory', $result[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\Forum\ForumCategory', $result[1]); $this->assertTrue($result[0] !== $result[1]); $this->assertEquals(1, $result[0]->getId()); $this->assertEquals(2, $result[1]->getId()); @@ -768,8 +768,8 @@ class ObjectHydratorTest extends HydrationTestCase $result = $hydrator->hydrateAll($stmt, $rsm, array(Query::HINT_FORCE_PARTIAL_LOAD => true)); $this->assertEquals(2, count($result)); - $this->assertTrue($result[0] instanceof CmsUser); - $this->assertTrue($result[1] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[1]); $this->assertEquals(0, $result[0]->articles->count()); $this->assertEquals(0, $result[1]->articles->count()); } @@ -826,19 +826,19 @@ class ObjectHydratorTest extends HydrationTestCase $this->assertEquals(3, count($result)); - $this->assertTrue($result[0][0] instanceof CmsUser); // User object + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0][0]); // User object $this->assertEquals(1, $result[0]['id']); $this->assertEquals('The First', $result[0]['topic']); $this->assertEquals(1, $result[0]['cid']); $this->assertEquals('First Comment', $result[0]['ctopic']); - $this->assertTrue($result[1][0] instanceof CmsUser); // Same User object + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[1][0]); // Same User object $this->assertEquals(1, $result[1]['id']); // duplicated $this->assertEquals('The First', $result[1]['topic']); // duplicated $this->assertEquals(2, $result[1]['cid']); $this->assertEquals('Second Comment', $result[1]['ctopic']); - $this->assertTrue($result[2][0] instanceof CmsUser); // Same User object + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[2][0]); // Same User object $this->assertEquals(42, $result[2]['id']); $this->assertEquals('The Answer', $result[2]['topic']); $this->assertNull($result[2]['cid']); @@ -877,7 +877,7 @@ class ObjectHydratorTest extends HydrationTestCase $rowNum = 0; while (($row = $iterableResult->next()) !== false) { $this->assertEquals(1, count($row)); - $this->assertTrue($row[0] instanceof \Doctrine\Tests\Models\CMS\CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $row[0]); if ($rowNum == 0) { $this->assertEquals(1, $row[0]->id); $this->assertEquals('romanb', $row[0]->name); diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php index 7f7d3d6cf..7868fb2fb 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php @@ -105,7 +105,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase )); $assoc = $cm->associationMappings['groups']; - //$this->assertTrue($assoc instanceof \Doctrine\ORM\Mapping\ManyToManyMapping); + //$this->assertInstanceOf('Doctrine\ORM\Mapping\ManyToManyMapping', $assoc); $this->assertEquals(array( 'name' => 'cmsuser_cmsgroup', 'joinColumns' => array(array('name' => 'cmsuser_id', 'referencedColumnName' => 'id', 'onDelete' => 'CASCADE')), diff --git a/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php b/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php index 11b3d113d..0dfbcc2f3 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php @@ -212,7 +212,7 @@ abstract class AbstractClassMetadataExporterTest extends \Doctrine\Tests\OrmTest public function testOneToOneAssociationsAreExported($class) { $this->assertTrue(isset($class->associationMappings['address'])); - //$this->assertTrue($class->associationMappings['address'] instanceof \Doctrine\ORM\Mapping\OneToOneMapping); + //$this->assertInstanceOf('Doctrine\ORM\Mapping\OneToOneMapping', $class->associationMappings['address']); $this->assertEquals('Doctrine\Tests\ORM\Tools\Export\Address', $class->associationMappings['address']['targetEntity']); $this->assertEquals('address_id', $class->associationMappings['address']['joinColumns'][0]['name']); $this->assertEquals('id', $class->associationMappings['address']['joinColumns'][0]['referencedColumnName']); @@ -234,7 +234,7 @@ abstract class AbstractClassMetadataExporterTest extends \Doctrine\Tests\OrmTest public function testOneToManyAssociationsAreExported($class) { $this->assertTrue(isset($class->associationMappings['phonenumbers'])); - //$this->assertTrue($class->associationMappings['phonenumbers'] instanceof \Doctrine\ORM\Mapping\OneToManyMapping); + //$this->assertInstanceOf('Doctrine\ORM\Mapping\OneToManyMapping', $class->associationMappings['phonenumbers']); $this->assertEquals('Doctrine\Tests\ORM\Tools\Export\Phonenumber', $class->associationMappings['phonenumbers']['targetEntity']); $this->assertEquals('user', $class->associationMappings['phonenumbers']['mappedBy']); $this->assertEquals(array('number' => 'ASC'), $class->associationMappings['phonenumbers']['orderBy']); @@ -255,7 +255,7 @@ abstract class AbstractClassMetadataExporterTest extends \Doctrine\Tests\OrmTest public function testManyToManyAssociationsAreExported($class) { $this->assertTrue(isset($class->associationMappings['groups'])); - //$this->assertTrue($class->associationMappings['groups'] instanceof \Doctrine\ORM\Mapping\ManyToManyMapping); + //$this->assertInstanceOf('Doctrine\ORM\Mapping\ManyToManyMapping', $class->associationMappings['groups']); $this->assertEquals('Doctrine\Tests\ORM\Tools\Export\Group', $class->associationMappings['groups']['targetEntity']); $this->assertEquals('cms_users_groups', $class->associationMappings['groups']['joinTable']['name']); From 196632978cf39bc3914e14739767cb5b72a8df9d Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Wed, 27 Jul 2011 23:22:20 +0200 Subject: [PATCH 16/35] DDC-1298 - Fix bug in SQLWalker with derived entities that have no fields of their own. --- lib/Doctrine/ORM/Query/SqlWalker.php | 2 +- tests/Doctrine/Tests/Models/DDC117/DDC117Article.php | 5 +++++ .../Tests/ORM/Query/SelectSqlGenerationTest.php | 11 +++++++++++ tests/Doctrine/Tests/OrmFunctionalTestCase.php | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Query/SqlWalker.php b/lib/Doctrine/ORM/Query/SqlWalker.php index 7393ba893..b4e8b3f15 100644 --- a/lib/Doctrine/ORM/Query/SqlWalker.php +++ b/lib/Doctrine/ORM/Query/SqlWalker.php @@ -511,7 +511,7 @@ class SqlWalker implements TreeWalker public function walkSelectClause($selectClause) { $sql = 'SELECT ' . (($selectClause->isDistinct) ? 'DISTINCT ' : '') . implode( - ', ', array_map(array($this, 'walkSelectExpression'), $selectClause->selectExpressions) + ', ', array_filter(array_map(array($this, 'walkSelectExpression'), $selectClause->selectExpressions)) ); $addMetaColumns = ! $this->_query->getHint(Query::HINT_FORCE_PARTIAL_LOAD) && diff --git a/tests/Doctrine/Tests/Models/DDC117/DDC117Article.php b/tests/Doctrine/Tests/Models/DDC117/DDC117Article.php index 111c4fabe..51ea2278d 100644 --- a/tests/Doctrine/Tests/Models/DDC117/DDC117Article.php +++ b/tests/Doctrine/Tests/Models/DDC117/DDC117Article.php @@ -27,6 +27,11 @@ class DDC117Article */ private $translations; + /** + * @OneToMany(targetEntity="DDC117Link", mappedBy="source") + */ + private $links; + public function __construct($title) { $this->title = $title; diff --git a/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php b/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php index ad5ce1329..6319f85fd 100644 --- a/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php +++ b/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php @@ -965,6 +965,17 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase "SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3, (SELECT c1_.name FROM cms_users c1_ WHERE c1_.id = c0_.id AND c1_.name IN (SELECT c2_.name FROM cms_users c2_)) AS sclr4 FROM cms_users c0_" ); } + + /** + * @group DDC-1298 + */ + public function testSelectForeignKeyPKWithoutFields() + { + $this->assertSqlGeneration( + "SELECT t, s, l FROM Doctrine\Tests\Models\DDC117\DDC117Link l INNER JOIN l.target t INNER JOIN l.source s", + "SELECT d0_.article_id AS article_id0, d0_.title AS title1, d1_.article_id AS article_id2, d1_.title AS title3 FROM DDC117Link d2_ INNER JOIN DDC117Article d0_ ON d2_.target_id = d0_.article_id INNER JOIN DDC117Article d1_ ON d2_.source_id = d1_.article_id" + ); + } } diff --git a/tests/Doctrine/Tests/OrmFunctionalTestCase.php b/tests/Doctrine/Tests/OrmFunctionalTestCase.php index 1f8032aeb..876f13954 100644 --- a/tests/Doctrine/Tests/OrmFunctionalTestCase.php +++ b/tests/Doctrine/Tests/OrmFunctionalTestCase.php @@ -98,6 +98,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase 'Doctrine\Tests\Models\DDC117\DDC117ArticleDetails', 'Doctrine\Tests\Models\DDC117\DDC117ApproveChanges', 'Doctrine\Tests\Models\DDC117\DDC117Editor', + 'Doctrine\Tests\Models\DDC117\DDC117Link', ), 'stockexchange' => array( 'Doctrine\Tests\Models\StockExchange\Bond', @@ -191,6 +192,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase $conn->executeUpdate('DELETE FROM ddc117editor_ddc117translation'); $conn->executeUpdate('DELETE FROM DDC117Editor'); $conn->executeUpdate('DELETE FROM DDC117ApproveChanges'); + $conn->executeUpdate('DELETE FROM DDC117Link'); $conn->executeUpdate('DELETE FROM DDC117Reference'); $conn->executeUpdate('DELETE FROM DDC117ArticleDetails'); $conn->executeUpdate('DELETE FROM DDC117Translation'); From b2951691e2c476a2c87212fdf9d0b8deec88d390 Mon Sep 17 00:00:00 2001 From: Alexander Date: Thu, 28 Jul 2011 10:46:38 +0200 Subject: [PATCH 17/35] [DDC-1301] Added tests for fetch="EXTRA_LAZY" count() on a "legacy" database --- .../Tests/Models/Legacy/LegacyArticle.php | 33 ++++ .../Tests/Models/Legacy/LegacyCar.php | 41 +++++ .../Tests/Models/Legacy/LegacyUser.php | 80 ++++++++++ .../Models/Legacy/LegacyUserReference.php | 65 ++++++++ .../ORM/Functional/Ticket/DDC1301Test.php | 148 ++++++++++++++++++ .../Doctrine/Tests/OrmFunctionalTestCase.php | 12 ++ 6 files changed, 379 insertions(+) create mode 100644 tests/Doctrine/Tests/Models/Legacy/LegacyArticle.php create mode 100644 tests/Doctrine/Tests/Models/Legacy/LegacyCar.php create mode 100644 tests/Doctrine/Tests/Models/Legacy/LegacyUser.php create mode 100644 tests/Doctrine/Tests/Models/Legacy/LegacyUserReference.php create mode 100644 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php diff --git a/tests/Doctrine/Tests/Models/Legacy/LegacyArticle.php b/tests/Doctrine/Tests/Models/Legacy/LegacyArticle.php new file mode 100644 index 000000000..e373c337d --- /dev/null +++ b/tests/Doctrine/Tests/Models/Legacy/LegacyArticle.php @@ -0,0 +1,33 @@ +user = $author; + } +} diff --git a/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php b/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php new file mode 100644 index 000000000..a27d3c34c --- /dev/null +++ b/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php @@ -0,0 +1,41 @@ +description; + } + + public function addUser(LegacyUser $user) { + $this->users[] = $user; + } + + public function getUsers() { + return $this->users; + } +} diff --git a/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php b/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php new file mode 100644 index 000000000..fb06263a2 --- /dev/null +++ b/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php @@ -0,0 +1,80 @@ +articles = new ArrayCollection; + $this->references = new ArrayCollection; + $this->cars = new ArrayCollection; + } + + public function getId() { + return $this->id; + } + + public function getUsername() { + return $this->username; + } + + public function addArticle(LegacyArticle $article) { + $this->articles[] = $article; + $article->setAuthor($this); + } + + public function addReference($reference) + { + $this->references[] = $reference; + } + + public function references() + { + return $this->references; + } + + public function addCar(LegacyCar $car) { + $this->cars[] = $car; + $car->addUser($this); + } + + public function getCars() { + return $this->cars; + } +} diff --git a/tests/Doctrine/Tests/Models/Legacy/LegacyUserReference.php b/tests/Doctrine/Tests/Models/Legacy/LegacyUserReference.php new file mode 100644 index 000000000..8b1ee9407 --- /dev/null +++ b/tests/Doctrine/Tests/Models/Legacy/LegacyUserReference.php @@ -0,0 +1,65 @@ +addReference($this); + $target->addReference($this); + + $this->source = $source; + $this->target = $target; + $this->description = $description; + $this->created = new \DateTime("now"); + } + + public function source() + { + return $this->source; + } + + public function target() + { + return $this->target; + } + + public function setDescription($desc) + { + $this->description = $desc; + } + + public function getDescription() + { + return $this->description; + } +} diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php new file mode 100644 index 000000000..f1dd02498 --- /dev/null +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php @@ -0,0 +1,148 @@ +useModelSet('legacy'); + parent::setUp(); + + $class = $this->_em->getClassMetadata('Doctrine\Tests\Models\Legacy\LegacyUser'); + $class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; + $class->associationMappings['references']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; + $class->associationMappings['cars']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; + + $this->loadFixture(); + } + + public function tearDown() + { + parent::tearDown(); + + $class = $this->_em->getClassMetadata('Doctrine\Tests\Models\Legacy\LegacyUser'); + $class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_LAZY; + $class->associationMappings['references']['fetch'] = ClassMetadataInfo::FETCH_LAZY; + $class->associationMappings['cars']['fetch'] = ClassMetadataInfo::FETCH_LAZY; + } + + public function testCountNotInitializesLegacyCollection() + { + $user = $this->_em->find('Doctrine\Tests\Models\Legacy\LegacyUser', $this->userId); + $queryCount = $this->getCurrentQueryCount(); + + $this->assertFalse($user->articles->isInitialized()); + $this->assertEquals(2, count($user->articles)); + $this->assertFalse($user->articles->isInitialized()); + + foreach ($user->articles AS $article) { } + + $this->assertEquals($queryCount + 2, $this->getCurrentQueryCount(), "Expecting two queries to be fired for count, then iteration."); + } + + public function testCountNotInitializesLegacyCollectionWithForeignIdentifier() + { + $user = $this->_em->find('Doctrine\Tests\Models\Legacy\LegacyUser', $this->userId); + $queryCount = $this->getCurrentQueryCount(); + + $this->assertFalse($user->references->isInitialized()); + $this->assertEquals(2, count($user->references)); + $this->assertFalse($user->references->isInitialized()); + + foreach ($user->references AS $reference) { } + + $this->assertEquals($queryCount + 2, $this->getCurrentQueryCount(), "Expecting two queries to be fired for count, then iteration."); + } + + public function testCountNotInitializesLegacyManyToManyCollection() + { + $user = $this->_em->find('Doctrine\Tests\Models\Legacy\LegacyUser', $this->userId); + $queryCount = $this->getCurrentQueryCount(); + + $this->assertFalse($user->cars->isInitialized()); + $this->assertEquals(3, count($user->cars)); + $this->assertFalse($user->cars->isInitialized()); + + foreach ($user->cars AS $reference) { } + + $this->assertEquals($queryCount + 2, $this->getCurrentQueryCount(), "Expecting two queries to be fired for count, then iteration."); + } + + public function loadFixture() + { + $user1 = new \Doctrine\Tests\Models\Legacy\LegacyUser(); + $user1->username = "beberlei"; + $user1->name = "Benjamin"; + $user1->status = "active"; + + $user2 = new \Doctrine\Tests\Models\Legacy\LegacyUser(); + $user2->username = "jwage"; + $user2->name = "Jonathan"; + $user2->status = "active"; + + $user3 = new \Doctrine\Tests\Models\Legacy\LegacyUser(); + $user3->username = "romanb"; + $user3->name = "Roman"; + $user3->status = "active"; + + $this->_em->persist($user1); + $this->_em->persist($user2); + $this->_em->persist($user3); + + $article1 = new \Doctrine\Tests\Models\Legacy\LegacyArticle(); + $article1->topic = "Test"; + $article1->text = "Test"; + $article1->setAuthor($user1); + + $article2 = new \Doctrine\Tests\Models\Legacy\LegacyArticle(); + $article2->topic = "Test"; + $article2->text = "Test"; + $article2->setAuthor($user1); + + $this->_em->persist($article1); + $this->_em->persist($article2); + + $car1 = new \Doctrine\Tests\Models\Legacy\LegacyCar(); + $car1->description = "Test1"; + + $car2 = new \Doctrine\Tests\Models\Legacy\LegacyCar(); + $car2->description = "Test2"; + + $car3 = new \Doctrine\Tests\Models\Legacy\LegacyCar(); + $car3->description = "Test3"; + + $user1->addCar($car1); + $user1->addCar($car2); + $user1->addCar($car3); + + $user2->addCar($car1); + $user3->addCar($car1); + + $this->_em->persist($car1); + $this->_em->persist($car2); + $this->_em->persist($car3); + + $this->_em->flush(); + + $detail1 = new \Doctrine\Tests\Models\Legacy\LegacyUserReference($user1, $user2, "foo"); + $detail2 = new \Doctrine\Tests\Models\Legacy\LegacyUserReference($user1, $user3, "bar"); + + $this->_em->persist($detail1); + $this->_em->persist($detail2); + + $this->_em->flush(); + $this->_em->clear(); + + $this->userId = $user1->getId(); + } +} diff --git a/tests/Doctrine/Tests/OrmFunctionalTestCase.php b/tests/Doctrine/Tests/OrmFunctionalTestCase.php index 1f8032aeb..66d20b38f 100644 --- a/tests/Doctrine/Tests/OrmFunctionalTestCase.php +++ b/tests/Doctrine/Tests/OrmFunctionalTestCase.php @@ -104,6 +104,12 @@ abstract class OrmFunctionalTestCase extends OrmTestCase 'Doctrine\Tests\Models\StockExchange\Stock', 'Doctrine\Tests\Models\StockExchange\Market', ), + 'legacy' => array( + 'Doctrine\Tests\Models\Legacy\LegacyUser', + 'Doctrine\Tests\Models\Legacy\LegacyUserReference', + 'Doctrine\Tests\Models\Legacy\LegacyArticle', + 'Doctrine\Tests\Models\Legacy\LegacyCar', + ), ); protected function useModelSet($setName) @@ -202,6 +208,12 @@ abstract class OrmFunctionalTestCase extends OrmTestCase $conn->executeUpdate('DELETE FROM exchange_stocks'); $conn->executeUpdate('DELETE FROM exchange_markets'); } + if (isset($this->_usedModelSets['legacy'])) { + $conn->executeUpdate('DELETE FROM legacy_articles'); + $conn->executeUpdate('DELETE FROM legacy_cars'); + $conn->executeUpdate('DELETE FROM legacy_users'); + $conn->executeUpdate('DELETE FROM legacy_users_reference'); + } $this->_em->clear(); } From d7dbde8f3e2ecbc341e8de47127d0706411bb910 Mon Sep 17 00:00:00 2001 From: Alexander Date: Thu, 28 Jul 2011 11:01:52 +0200 Subject: [PATCH 18/35] [DDC-1301] Fixed count() for fetch="EXTRA_LAZY" on OneToMany association --- .../ORM/Persisters/OneToManyPersister.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/Doctrine/ORM/Persisters/OneToManyPersister.php b/lib/Doctrine/ORM/Persisters/OneToManyPersister.php index 5e889ddb9..e9fcf06c5 100644 --- a/lib/Doctrine/ORM/Persisters/OneToManyPersister.php +++ b/lib/Doctrine/ORM/Persisters/OneToManyPersister.php @@ -124,24 +124,26 @@ class OneToManyPersister extends AbstractCollectionPersister public function count(PersistentCollection $coll) { $mapping = $coll->getMapping(); - $class = $this->_em->getClassMetadata($mapping['targetEntity']); + $targetClass = $this->_em->getClassMetadata($mapping['targetEntity']); + $sourceClass = $this->_em->getClassMetadata($mapping['sourceEntity']); + $params = array(); $id = $this->_em->getUnitOfWork()->getEntityIdentifier($coll->getOwner()); $where = ''; - foreach ($class->associationMappings[$mapping['mappedBy']]['joinColumns'] AS $joinColumn) { + foreach ($targetClass->associationMappings[$mapping['mappedBy']]['joinColumns'] AS $joinColumn) { if ($where != '') { $where .= ' AND '; } $where .= $joinColumn['name'] . " = ?"; - if ($class->containsForeignIdentifier) { - $params[] = $id[$class->getFieldForColumn($joinColumn['referencedColumnName'])]; + if ($targetClass->containsForeignIdentifier) { + $params[] = $id[$sourceClass->getFieldForColumn($joinColumn['referencedColumnName'])]; } else { - $params[] = $id[$class->fieldNames[$joinColumn['referencedColumnName']]]; + $params[] = $id[$sourceClass->fieldNames[$joinColumn['referencedColumnName']]]; } } - $sql = "SELECT count(*) FROM " . $class->getQuotedTableName($this->_conn->getDatabasePlatform()) . " WHERE " . $where; + $sql = "SELECT count(*) FROM " . $targetClass->getQuotedTableName($this->_conn->getDatabasePlatform()) . " WHERE " . $where; return $this->_conn->fetchColumn($sql, $params); } @@ -180,4 +182,4 @@ class OneToManyPersister extends AbstractCollectionPersister return $uow->getEntityPersister($mapping['targetEntity']) ->exists($element, array($mapping['mappedBy'] => $id)); } -} \ No newline at end of file +} From d439f67df5afe43858defbf8e4777afb0fcbb680 Mon Sep 17 00:00:00 2001 From: Alexander Date: Thu, 28 Jul 2011 12:25:23 +0200 Subject: [PATCH 19/35] [DDC-1301] Prefixed all Legacy models properties with _ --- .../Tests/Models/Legacy/LegacyArticle.php | 12 ++-- .../Tests/Models/Legacy/LegacyCar.php | 14 ++-- .../Tests/Models/Legacy/LegacyUser.php | 38 +++++------ .../Models/Legacy/LegacyUserReference.php | 28 ++++---- .../ORM/Functional/Ticket/DDC1301Test.php | 68 +++++++++---------- 5 files changed, 80 insertions(+), 80 deletions(-) diff --git a/tests/Doctrine/Tests/Models/Legacy/LegacyArticle.php b/tests/Doctrine/Tests/Models/Legacy/LegacyArticle.php index e373c337d..fb754462e 100644 --- a/tests/Doctrine/Tests/Models/Legacy/LegacyArticle.php +++ b/tests/Doctrine/Tests/Models/Legacy/LegacyArticle.php @@ -13,21 +13,21 @@ class LegacyArticle * @Column(name="iArticleId", type="integer") * @GeneratedValue(strategy="AUTO") */ - public $id; + public $_id; /** * @Column(name="sTopic", type="string", length=255) */ - public $topic; + public $_topic; /** * @Column(name="sText", type="text") */ - public $text; + public $_text; /** - * @ManyToOne(targetEntity="LegacyUser", inversedBy="articles") + * @ManyToOne(targetEntity="LegacyUser", inversedBy="_articles") * @JoinColumn(name="iUserId", referencedColumnName="iUserId") */ - public $user; + public $_user; public function setAuthor(LegacyUser $author) { - $this->user = $author; + $this->_user = $author; } } diff --git a/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php b/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php index a27d3c34c..ac3834145 100644 --- a/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php +++ b/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php @@ -15,27 +15,27 @@ class LegacyCar * @GeneratedValue * @Column(name="iCarId", type="integer", nullable=false) */ - public $id; + public $_id; /** - * @ManyToMany(targetEntity="LegacyUser", mappedBy="cars") + * @ManyToMany(targetEntity="LegacyUser", mappedBy="_cars") */ - public $users; + public $_users; /** * @Column(name="sDescription", type="string", length=255, unique=true) */ - public $description; + public $_description; function getDescription() { - return $this->description; + return $this->_description; } public function addUser(LegacyUser $user) { - $this->users[] = $user; + $this->_users[] = $user; } public function getUsers() { - return $this->users; + return $this->_users; } } diff --git a/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php b/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php index fb06263a2..d7c9a5c37 100644 --- a/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php +++ b/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php @@ -15,66 +15,66 @@ class LegacyUser * @GeneratedValue * @Column(name="iUserId", type="integer", nullable=false) */ - public $id; + public $_id; /** * @Column(name="sUsername", type="string", length=255, unique=true) */ - public $username; + public $_username; /** * @Column(type="string", length=255) */ - public $name; + public $_name; /** - * @OneToMany(targetEntity="LegacyArticle", mappedBy="user") + * @OneToMany(targetEntity="LegacyArticle", mappedBy="_user") */ - public $articles; + public $_articles; /** - * @OneToMany(targetEntity="LegacyUserReference", mappedBy="source", cascade={"remove"}) + * @OneToMany(targetEntity="LegacyUserReference", mappedBy="_source", cascade={"remove"}) */ - public $references; + public $_references; /** - * @ManyToMany(targetEntity="LegacyCar", inversedBy="users", cascade={"persist", "merge"}) + * @ManyToMany(targetEntity="LegacyCar", inversedBy="_users", cascade={"persist", "merge"}) * @JoinTable(name="legace_users_cars", * joinColumns={@JoinColumn(name="iUserId", referencedColumnName="iUserId")}, * inverseJoinColumns={@JoinColumn(name="iCarId", referencedColumnName="iCarId")} * ) */ - public $cars; + public $_cars; public function __construct() { - $this->articles = new ArrayCollection; - $this->references = new ArrayCollection; - $this->cars = new ArrayCollection; + $this->_articles = new ArrayCollection; + $this->_references = new ArrayCollection; + $this->_cars = new ArrayCollection; } public function getId() { - return $this->id; + return $this->_id; } public function getUsername() { - return $this->username; + return $this->_username; } public function addArticle(LegacyArticle $article) { - $this->articles[] = $article; + $this->_articles[] = $article; $article->setAuthor($this); } public function addReference($reference) { - $this->references[] = $reference; + $this->_references[] = $reference; } public function references() { - return $this->references; + return $this->_references; } public function addCar(LegacyCar $car) { - $this->cars[] = $car; + $this->_cars[] = $car; $car->addUser($this); } public function getCars() { - return $this->cars; + return $this->_cars; } } diff --git a/tests/Doctrine/Tests/Models/Legacy/LegacyUserReference.php b/tests/Doctrine/Tests/Models/Legacy/LegacyUserReference.php index 8b1ee9407..c6cd891a1 100644 --- a/tests/Doctrine/Tests/Models/Legacy/LegacyUserReference.php +++ b/tests/Doctrine/Tests/Models/Legacy/LegacyUserReference.php @@ -10,56 +10,56 @@ class LegacyUserReference { /** * @Id - * @ManyToOne(targetEntity="LegacyUser", inversedBy="references") + * @ManyToOne(targetEntity="LegacyUser", inversedBy="_references") * @JoinColumn(name="iUserIdSource", referencedColumnName="iUserId") */ - private $source; + private $_source; /** * @Id - * @ManyToOne(targetEntity="LegacyUser", inversedBy="references") + * @ManyToOne(targetEntity="LegacyUser", inversedBy="_references") * @JoinColumn(name="iUserIdTarget", referencedColumnName="iUserId") */ - private $target; + private $_target; /** * @column(type="string") */ - private $description; + private $_description; /** * @column(type="datetime") */ - private $created; + private $_created; public function __construct($source, $target, $description) { $source->addReference($this); $target->addReference($this); - $this->source = $source; - $this->target = $target; - $this->description = $description; - $this->created = new \DateTime("now"); + $this->_source = $source; + $this->_target = $target; + $this->_description = $description; + $this->_created = new \DateTime("now"); } public function source() { - return $this->source; + return $this->_source; } public function target() { - return $this->target; + return $this->_target; } public function setDescription($desc) { - $this->description = $desc; + $this->_description = $desc; } public function getDescription() { - return $this->description; + return $this->_description; } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php index f1dd02498..94d02f905 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php @@ -19,9 +19,9 @@ class DDC1301Test extends \Doctrine\Tests\OrmFunctionalTestCase parent::setUp(); $class = $this->_em->getClassMetadata('Doctrine\Tests\Models\Legacy\LegacyUser'); - $class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; - $class->associationMappings['references']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; - $class->associationMappings['cars']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; + $class->associationMappings['_articles']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; + $class->associationMappings['_references']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; + $class->associationMappings['_cars']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; $this->loadFixture(); } @@ -31,9 +31,9 @@ class DDC1301Test extends \Doctrine\Tests\OrmFunctionalTestCase parent::tearDown(); $class = $this->_em->getClassMetadata('Doctrine\Tests\Models\Legacy\LegacyUser'); - $class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_LAZY; - $class->associationMappings['references']['fetch'] = ClassMetadataInfo::FETCH_LAZY; - $class->associationMappings['cars']['fetch'] = ClassMetadataInfo::FETCH_LAZY; + $class->associationMappings['_articles']['fetch'] = ClassMetadataInfo::FETCH_LAZY; + $class->associationMappings['_references']['fetch'] = ClassMetadataInfo::FETCH_LAZY; + $class->associationMappings['_cars']['fetch'] = ClassMetadataInfo::FETCH_LAZY; } public function testCountNotInitializesLegacyCollection() @@ -41,11 +41,11 @@ class DDC1301Test extends \Doctrine\Tests\OrmFunctionalTestCase $user = $this->_em->find('Doctrine\Tests\Models\Legacy\LegacyUser', $this->userId); $queryCount = $this->getCurrentQueryCount(); - $this->assertFalse($user->articles->isInitialized()); - $this->assertEquals(2, count($user->articles)); - $this->assertFalse($user->articles->isInitialized()); + $this->assertFalse($user->_articles->isInitialized()); + $this->assertEquals(2, count($user->_articles)); + $this->assertFalse($user->_articles->isInitialized()); - foreach ($user->articles AS $article) { } + foreach ($user->_articles AS $article) { } $this->assertEquals($queryCount + 2, $this->getCurrentQueryCount(), "Expecting two queries to be fired for count, then iteration."); } @@ -55,11 +55,11 @@ class DDC1301Test extends \Doctrine\Tests\OrmFunctionalTestCase $user = $this->_em->find('Doctrine\Tests\Models\Legacy\LegacyUser', $this->userId); $queryCount = $this->getCurrentQueryCount(); - $this->assertFalse($user->references->isInitialized()); - $this->assertEquals(2, count($user->references)); - $this->assertFalse($user->references->isInitialized()); + $this->assertFalse($user->_references->isInitialized()); + $this->assertEquals(2, count($user->_references)); + $this->assertFalse($user->_references->isInitialized()); - foreach ($user->references AS $reference) { } + foreach ($user->_references AS $reference) { } $this->assertEquals($queryCount + 2, $this->getCurrentQueryCount(), "Expecting two queries to be fired for count, then iteration."); } @@ -69,11 +69,11 @@ class DDC1301Test extends \Doctrine\Tests\OrmFunctionalTestCase $user = $this->_em->find('Doctrine\Tests\Models\Legacy\LegacyUser', $this->userId); $queryCount = $this->getCurrentQueryCount(); - $this->assertFalse($user->cars->isInitialized()); - $this->assertEquals(3, count($user->cars)); - $this->assertFalse($user->cars->isInitialized()); + $this->assertFalse($user->_cars->isInitialized()); + $this->assertEquals(3, count($user->_cars)); + $this->assertFalse($user->_cars->isInitialized()); - foreach ($user->cars AS $reference) { } + foreach ($user->_cars AS $reference) { } $this->assertEquals($queryCount + 2, $this->getCurrentQueryCount(), "Expecting two queries to be fired for count, then iteration."); } @@ -81,45 +81,45 @@ class DDC1301Test extends \Doctrine\Tests\OrmFunctionalTestCase public function loadFixture() { $user1 = new \Doctrine\Tests\Models\Legacy\LegacyUser(); - $user1->username = "beberlei"; - $user1->name = "Benjamin"; - $user1->status = "active"; + $user1->_username = "beberlei"; + $user1->_name = "Benjamin"; + $user1->_status = "active"; $user2 = new \Doctrine\Tests\Models\Legacy\LegacyUser(); - $user2->username = "jwage"; - $user2->name = "Jonathan"; - $user2->status = "active"; + $user2->_username = "jwage"; + $user2->_name = "Jonathan"; + $user2->_status = "active"; $user3 = new \Doctrine\Tests\Models\Legacy\LegacyUser(); - $user3->username = "romanb"; - $user3->name = "Roman"; - $user3->status = "active"; + $user3->_username = "romanb"; + $user3->_name = "Roman"; + $user3->_status = "active"; $this->_em->persist($user1); $this->_em->persist($user2); $this->_em->persist($user3); $article1 = new \Doctrine\Tests\Models\Legacy\LegacyArticle(); - $article1->topic = "Test"; - $article1->text = "Test"; + $article1->_topic = "Test"; + $article1->_text = "Test"; $article1->setAuthor($user1); $article2 = new \Doctrine\Tests\Models\Legacy\LegacyArticle(); - $article2->topic = "Test"; - $article2->text = "Test"; + $article2->_topic = "Test"; + $article2->_text = "Test"; $article2->setAuthor($user1); $this->_em->persist($article1); $this->_em->persist($article2); $car1 = new \Doctrine\Tests\Models\Legacy\LegacyCar(); - $car1->description = "Test1"; + $car1->_description = "Test1"; $car2 = new \Doctrine\Tests\Models\Legacy\LegacyCar(); - $car2->description = "Test2"; + $car2->_description = "Test2"; $car3 = new \Doctrine\Tests\Models\Legacy\LegacyCar(); - $car3->description = "Test3"; + $car3->_description = "Test3"; $user1->addCar($car1); $user1->addCar($car2); From 1250cd7a5aa3697fbc9743bc666bcbaa5d4a8aba Mon Sep 17 00:00:00 2001 From: Michael Ridgway Date: Thu, 28 Jul 2011 10:50:22 -0400 Subject: [PATCH 20/35] F[DDC-1275] ixed check for owning side of a toOne relationship --- .../ORM/Query/ResultSetMappingBuilder.php | 36 +++++++------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php b/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php index 95d548daf..d1690b72c 100644 --- a/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php +++ b/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php @@ -20,6 +20,7 @@ namespace Doctrine\ORM\Query; use Doctrine\ORM\EntityManager; +use Doctrine\ORM\Mapping\ClassMetadataInfo; /** * A ResultSetMappingBuilder uses the EntityManager to automatically populate entity fields @@ -52,22 +53,7 @@ class ResultSetMappingBuilder extends ResultSetMapping public function addRootEntityFromClassMetadata($class, $alias, $renamedColumns = array()) { $this->addEntityResult($class, $alias); - $classMetadata = $this->em->getClassMetadata($class); - if ($classMetadata->isInheritanceTypeSingleTable() || $classMetadata->isInheritanceTypeJoined()) { - throw new \InvalidArgumentException('ResultSetMapping builder does not currently support inheritance.'); - } - $platform = $this->em->getConnection()->getDatabasePlatform(); - foreach ($classMetadata->getColumnNames() AS $columnName) { - $propertyName = $classMetadata->getFieldName($columnName); - if (isset($renamedColumns[$columnName])) { - $columnName = $renamedColumns[$columnName]; - } - if (isset($this->fieldMappings[$columnName])) { - throw new \InvalidArgumentException("The column '$columnName' conflicts with another column in the mapper."); - } - $this->addFieldResult($alias, $platform->getSQLResultCasing($columnName), $propertyName); - } - $this->addAssocationMappings($alias, $classMetadata->getAssociationMappings()); + $this->addAllClassFields($class, $alias, $renamedColumns); } /** @@ -82,6 +68,14 @@ class ResultSetMappingBuilder extends ResultSetMapping public function addJoinedEntityFromClassMetadata($class, $alias, $parentAlias, $relation, $renamedColumns = array()) { $this->addJoinedEntityResult($class, $alias, $parentAlias, $relation); + $this->addAllClassFields($class, $alias, $renamedColumns); + } + + /** + * Adds all fields of the given class to the result set mapping (columns and meta fields) + */ + protected function addAllClassFields($class, $alias, $renamedColumns = array()) + { $classMetadata = $this->em->getClassMetadata($class); if ($classMetadata->isInheritanceTypeSingleTable() || $classMetadata->isInheritanceTypeJoined()) { throw new \InvalidArgumentException('ResultSetMapping builder does not currently support inheritance.'); @@ -97,14 +91,8 @@ class ResultSetMappingBuilder extends ResultSetMapping } $this->addFieldResult($alias, $platform->getSQLResultCasing($columnName), $propertyName); } - $this->addAssocationMappings($alias, $classMetadata->getAssociationMappings()); - } - - protected function addAssocationMappings($alias, $associationMappings) - { - $platform = $this->em->getConnection()->getDatabasePlatform(); - foreach ($associationMappings AS $associationMapping) { - if (isset($associationMapping['joinColumns'])) { + foreach ($classMetadata->associationMappings AS $associationMapping) { + if ($associationMapping['isOwningSide'] && $associationMapping['type'] & ClassMetadataInfo::TO_ONE) { foreach ($associationMapping['joinColumns'] AS $joinColumn) { $columnName = $joinColumn['name']; $renamedColumnName = isset($renamedColumns[$columnName]) ? $renamedColumns[$columnName] : $columnName; From c34612b8e97ba5636d6eaae595669819963276e5 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Thu, 28 Jul 2011 23:44:11 +0200 Subject: [PATCH 21/35] [DDC-1298] DDC117Link file got lost from 2.1.x to master somehow --- .../Tests/Models/DDC117/DDC117Link.php | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/Doctrine/Tests/Models/DDC117/DDC117Link.php diff --git a/tests/Doctrine/Tests/Models/DDC117/DDC117Link.php b/tests/Doctrine/Tests/Models/DDC117/DDC117Link.php new file mode 100644 index 000000000..7e0084a67 --- /dev/null +++ b/tests/Doctrine/Tests/Models/DDC117/DDC117Link.php @@ -0,0 +1,31 @@ +source = $source; + $this->target = $target; + } +} From 953a0f657220f5256f9d59f388485521f6335bd5 Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 29 Jul 2011 09:35:59 +0200 Subject: [PATCH 22/35] [DDC-1301] Fixed tests teardown for mysql suite --- tests/Doctrine/Tests/Models/Legacy/LegacyUser.php | 2 +- tests/Doctrine/Tests/OrmFunctionalTestCase.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php b/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php index d7c9a5c37..f4f5e1fcb 100644 --- a/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php +++ b/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php @@ -34,7 +34,7 @@ class LegacyUser public $_references; /** * @ManyToMany(targetEntity="LegacyCar", inversedBy="_users", cascade={"persist", "merge"}) - * @JoinTable(name="legace_users_cars", + * @JoinTable(name="legacy_users_cars", * joinColumns={@JoinColumn(name="iUserId", referencedColumnName="iUserId")}, * inverseJoinColumns={@JoinColumn(name="iCarId", referencedColumnName="iCarId")} * ) diff --git a/tests/Doctrine/Tests/OrmFunctionalTestCase.php b/tests/Doctrine/Tests/OrmFunctionalTestCase.php index 50edbfd75..56345bc6f 100644 --- a/tests/Doctrine/Tests/OrmFunctionalTestCase.php +++ b/tests/Doctrine/Tests/OrmFunctionalTestCase.php @@ -211,10 +211,11 @@ abstract class OrmFunctionalTestCase extends OrmTestCase $conn->executeUpdate('DELETE FROM exchange_markets'); } if (isset($this->_usedModelSets['legacy'])) { + $conn->executeUpdate('DELETE FROM legacy_users_cars'); + $conn->executeUpdate('DELETE FROM legacy_users_reference'); $conn->executeUpdate('DELETE FROM legacy_articles'); $conn->executeUpdate('DELETE FROM legacy_cars'); $conn->executeUpdate('DELETE FROM legacy_users'); - $conn->executeUpdate('DELETE FROM legacy_users_reference'); } $this->_em->clear(); From 816039f23f3763129823a3c98ddf31286941e3ba Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sun, 31 Jul 2011 11:32:57 +0200 Subject: [PATCH 23/35] DDC-1302 - Fix bug in XmlDriver not handling orphan removal --- lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php | 8 ++++---- .../Tests/ORM/Mapping/AbstractMappingDriverTest.php | 5 +++-- .../ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php | 2 +- .../Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml | 2 +- .../Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml | 1 + 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php index c26a2a35c..ab8e3b780 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php @@ -285,8 +285,8 @@ class XmlDriver extends AbstractFileDriver $mapping['cascade'] = $this->_getCascadeMappings($oneToOneElement->cascade); } - if (isset($oneToOneElement->{'orphan-removal'})) { - $mapping['orphanRemoval'] = (bool)$oneToOneElement->{'orphan-removal'}; + if (isset($oneToOneElement['orphan-removal'])) { + $mapping['orphanRemoval'] = (bool)$oneToOneElement['orphan-removal']; } $metadata->mapOneToOne($mapping); @@ -310,8 +310,8 @@ class XmlDriver extends AbstractFileDriver $mapping['cascade'] = $this->_getCascadeMappings($oneToManyElement->cascade); } - if (isset($oneToManyElement->{'orphan-removal'})) { - $mapping['orphanRemoval'] = (bool)$oneToManyElement->{'orphan-removal'}; + if (isset($oneToManyElement['orphan-removal'])) { + $mapping['orphanRemoval'] = (bool)$oneToManyElement['orphan-removal']; } if (isset($oneToManyElement->{'order-by'})) { diff --git a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php index 6e4e2f353..8037a7fa7 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php @@ -186,6 +186,7 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase $this->assertFalse($class->associationMappings['phonenumbers']['isCascadeRefresh']); $this->assertFalse($class->associationMappings['phonenumbers']['isCascadeDetach']); $this->assertFalse($class->associationMappings['phonenumbers']['isCascadeMerge']); + $this->assertTrue($class->associationMappings['phonenumbers']['orphanRemoval']); // Test Order By $this->assertEquals(array('number' => 'ASC'), $class->associationMappings['phonenumbers']['orderBy']); @@ -328,7 +329,7 @@ class User public $address; /** - * @OneToMany(targetEntity="Phonenumber", mappedBy="user", cascade={"persist"}) + * @OneToMany(targetEntity="Phonenumber", mappedBy="user", cascade={"persist"}, orphanRemoval=true) * @OrderBy({"number"="ASC"}) */ public $phonenumbers; @@ -423,7 +424,7 @@ class User 1 => 'persist', ), 'mappedBy' => 'user', - 'orphanRemoval' => false, + 'orphanRemoval' => true, 'orderBy' => array( 'number' => 'ASC', diff --git a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php index 505188757..2039578a3 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php +++ b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php @@ -63,7 +63,7 @@ $metadata->mapOneToMany(array( 1 => 'persist', ), 'mappedBy' => 'user', - 'orphanRemoval' => false, + 'orphanRemoval' => true, 'orderBy' => array( 'number' => 'ASC', diff --git a/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml b/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml index c066cbef1..524b2494f 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml +++ b/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml @@ -39,7 +39,7 @@ - + diff --git a/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml b/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml index 490a21c2a..333474981 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml +++ b/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml @@ -34,6 +34,7 @@ Doctrine\Tests\ORM\Mapping\User: oneToMany: phonenumbers: targetEntity: Phonenumber + orphanRemoval: true mappedBy: user orderBy: number: ASC From ba882be76bdb9d2c33cfaef739af6bbba7abcc30 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Mon, 1 Aug 2011 21:45:21 +0200 Subject: [PATCH 24/35] DDC-1313 - Optimize behavior of DriverChain::getAllClassNames() --- lib/Doctrine/ORM/Mapping/Driver/DriverChain.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/Driver/DriverChain.php b/lib/Doctrine/ORM/Mapping/Driver/DriverChain.php index 77c258a18..d84d2344b 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/DriverChain.php +++ b/lib/Doctrine/ORM/Mapping/Driver/DriverChain.php @@ -88,15 +88,20 @@ class DriverChain implements Driver public function getAllClassNames() { $classNames = array(); + $driverClasses = array(); foreach ($this->_drivers AS $namespace => $driver) { - $driverClasses = $driver->getAllClassNames(); - foreach ($driverClasses AS $className) { + $oid = spl_object_hash($driver); + if (!isset($driverClasses[$oid])) { + $driverClasses[$oid] = $driver->getAllClassNames(); + } + + foreach ($driverClasses[$oid] AS $className) { if (strpos($className, $namespace) === 0) { - $classNames[] = $className; + $classNames[$className] = true; } } } - return array_unique($classNames); + return array_keys($classNames); } /** From c85de03b66a124f9cfa9f65917e4d9c11bb758c1 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Mon, 1 Aug 2011 23:09:03 +0200 Subject: [PATCH 25/35] Add phar packaging target and distribute phar into download folder --- build.xml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/build.xml b/build.xml index e9d2115f0..7981503a5 100644 --- a/build.xml +++ b/build.xml @@ -107,6 +107,23 @@ + + + + + + + + + + + + + + + + + @@ -206,6 +223,7 @@ + @@ -217,7 +235,7 @@ - +