From cd6131c9b8ae442b9de5c7e3f59610c17f485a7f Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Mon, 19 Dec 2011 22:56:19 +0100 Subject: [PATCH] Remove all trailing whitespaces --- lib/Doctrine/ORM/AbstractQuery.php | 2 +- lib/Doctrine/ORM/Configuration.php | 6 +- lib/Doctrine/ORM/Event/LifecycleEventArgs.php | 12 +- .../ORM/Event/LoadClassMetadataEventArgs.php | 6 +- lib/Doctrine/ORM/Event/OnClearEventArgs.php | 4 +- lib/Doctrine/ORM/Event/OnFlushEventArgs.php | 22 +- lib/Doctrine/ORM/Event/PostFlushEventArgs.php | 4 +- lib/Doctrine/ORM/Event/PreUpdateEventArgs.php | 14 +- lib/Doctrine/ORM/Events.php | 52 ++-- lib/Doctrine/ORM/Id/AbstractIdGenerator.php | 2 +- lib/Doctrine/ORM/Id/AssignedGenerator.php | 10 +- lib/Doctrine/ORM/Id/TableGenerator.php | 8 +- .../ORM/Internal/CommitOrderCalculator.php | 20 +- .../ORM/Internal/Hydration/ObjectHydrator.php | 8 +- .../ORM/Internal/Hydration/ScalarHydrator.php | 8 +- .../Hydration/SimpleObjectHydrator.php | 42 ++-- .../Hydration/SingleScalarHydrator.php | 10 +- .../Mapping/Builder/AssociationBuilder.php | 2 +- .../Mapping/Builder/ClassMetadataBuilder.php | 2 +- .../ORM/Mapping/Builder/FieldBuilder.php | 4 +- lib/Doctrine/ORM/Mapping/ClassMetadata.php | 2 +- .../ORM/Mapping/ClassMetadataFactory.php | 28 +-- .../ORM/Mapping/Driver/AbstractFileDriver.php | 36 +-- .../ORM/Mapping/Driver/AnnotationDriver.php | 10 +- .../ORM/Mapping/Driver/DatabaseDriver.php | 10 +- lib/Doctrine/ORM/Mapping/Driver/Driver.php | 8 +- .../ORM/Mapping/Driver/DriverChain.php | 2 +- .../ORM/Mapping/Driver/StaticPHPDriver.php | 10 +- lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php | 2 +- .../ORM/Mapping/Driver/YamlDriver.php | 2 +- lib/Doctrine/ORM/Mapping/MappingException.php | 2 +- lib/Doctrine/ORM/NoResultException.php | 2 +- lib/Doctrine/ORM/NonUniqueResultException.php | 2 +- lib/Doctrine/ORM/ORMException.php | 2 +- .../AbstractCollectionPersister.php | 22 +- .../AbstractEntityInheritancePersister.php | 10 +- .../ORM/Persisters/BasicEntityPersister.php | 4 +- .../ORM/Persisters/ManyToManyPersister.php | 58 ++--- .../ORM/Persisters/OneToManyPersister.php | 22 +- .../ORM/Persisters/SingleTablePersister.php | 22 +- .../ORM/Persisters/UnionSubclassPersister.php | 2 +- lib/Doctrine/ORM/Proxy/Proxy.php | 2 +- lib/Doctrine/ORM/Query.php | 2 +- .../ORM/Query/AST/ArithmeticFactor.php | 2 +- .../ORM/Query/AST/CoalesceExpression.php | 6 +- .../Query/AST/CollectionMemberExpression.php | 2 +- .../ORM/Query/AST/DeleteStatement.php | 2 +- .../EmptyCollectionComparisonExpression.php | 2 +- lib/Doctrine/ORM/Query/AST/FromClause.php | 4 +- .../ORM/Query/AST/Functions/AbsFunction.php | 4 +- .../AST/Functions/CurrentDateFunction.php | 2 +- .../Query/AST/Functions/IdentityFunction.php | 10 +- .../Query/AST/Functions/LengthFunction.php | 4 +- .../Query/AST/Functions/LocateFunction.php | 12 +- .../ORM/Query/AST/Functions/LowerFunction.php | 4 +- .../ORM/Query/AST/Functions/ModFunction.php | 8 +- .../ORM/Query/AST/Functions/SizeFunction.php | 12 +- .../ORM/Query/AST/Functions/SqrtFunction.php | 4 +- .../Query/AST/Functions/SubstringFunction.php | 6 +- .../ORM/Query/AST/Functions/UpperFunction.php | 4 +- .../ORM/Query/AST/GeneralCaseExpression.php | 6 +- .../AST/IdentificationVariableDeclaration.php | 2 +- lib/Doctrine/ORM/Query/AST/IndexBy.php | 4 +- .../ORM/Query/AST/InstanceOfExpression.php | 2 +- lib/Doctrine/ORM/Query/AST/Join.php | 4 +- .../AST/JoinAssociationPathExpression.php | 2 +- .../ORM/Query/AST/JoinVariableDeclaration.php | 2 +- lib/Doctrine/ORM/Query/AST/Literal.php | 6 +- lib/Doctrine/ORM/Query/AST/Node.php | 26 +- .../Query/AST/NullComparisonExpression.php | 2 +- .../ORM/Query/AST/NullIfExpression.php | 6 +- lib/Doctrine/ORM/Query/AST/OrderByItem.php | 2 +- .../ORM/Query/AST/PartialObjectExpression.php | 2 +- lib/Doctrine/ORM/Query/AST/PathExpression.php | 10 +- .../Query/AST/RangeVariableDeclaration.php | 4 +- lib/Doctrine/ORM/Query/AST/SelectClause.php | 2 +- .../ORM/Query/AST/SelectExpression.php | 4 +- .../ORM/Query/AST/SelectStatement.php | 4 +- .../ORM/Query/AST/SimpleCaseExpression.php | 6 +- .../ORM/Query/AST/SimpleSelectClause.php | 2 +- .../ORM/Query/AST/SimpleSelectExpression.php | 4 +- .../ORM/Query/AST/SimpleWhenClause.php | 6 +- lib/Doctrine/ORM/Query/AST/Subselect.php | 4 +- .../ORM/Query/AST/SubselectFromClause.php | 4 +- .../ORM/Query/AST/UpdateStatement.php | 2 +- lib/Doctrine/ORM/Query/AST/WhenClause.php | 6 +- .../Query/Exec/MultiTableDeleteExecutor.php | 6 +- .../Query/Exec/MultiTableUpdateExecutor.php | 28 +-- .../Exec/SingleTableDeleteUpdateExecutor.php | 2 +- lib/Doctrine/ORM/Query/Expr/Comparison.php | 2 +- lib/Doctrine/ORM/Query/Expr/From.php | 14 +- lib/Doctrine/ORM/Query/Expr/Join.php | 4 +- lib/Doctrine/ORM/Query/Expr/Math.php | 8 +- .../ORM/Query/ParameterTypeInferer.php | 4 +- lib/Doctrine/ORM/Query/ParserResult.php | 20 +- lib/Doctrine/ORM/Query/ResultSetMapping.php | 18 +- .../Command/ClearCache/MetadataCommand.php | 12 +- .../Command/ClearCache/QueryCommand.php | 12 +- .../Command/ClearCache/ResultCommand.php | 12 +- .../Command/ConvertDoctrine1SchemaCommand.php | 4 +- .../Command/GenerateEntitiesCommand.php | 4 +- .../Command/GenerateProxiesCommand.php | 2 +- .../Command/GenerateRepositoriesCommand.php | 2 +- .../Command/SchemaTool/UpdateCommand.php | 2 +- .../ORM/Tools/Console/ConsoleRunner.php | 2 +- .../ORM/Tools/Console/MetadataFilter.php | 2 +- .../ORM/Tools/ConvertDoctrine1Schema.php | 2 +- .../ORM/Tools/DebugUnitOfWorkListener.php | 2 +- .../DisconnectedClassMetadataFactory.php | 2 +- .../Tools/Export/Driver/AbstractExporter.php | 22 +- .../Export/Driver/AnnotationExporter.php | 2 +- .../ORM/Tools/Export/Driver/PhpExporter.php | 12 +- .../ORM/Tools/Export/Driver/XmlExporter.php | 8 +- .../ORM/Tools/Export/Driver/YamlExporter.php | 4 +- lib/Doctrine/ORM/Tools/Setup.php | 56 ++--- lib/Doctrine/ORM/Version.php | 4 +- .../Tests/Mocks/ClassMetadataMock.php | 4 +- tests/Doctrine/Tests/Mocks/DriverMock.php | 2 +- .../Tests/Mocks/EntityManagerMock.php | 10 +- .../Tests/Mocks/EntityPersisterMock.php | 12 +- .../Tests/Mocks/HydratorMockStatement.php | 2 +- tests/Doctrine/Tests/Mocks/MockTreeWalker.php | 2 +- .../Tests/Mocks/SchemaManagerMock.php | 2 +- .../Doctrine/Tests/Models/CMS/CmsArticle.php | 2 +- tests/Doctrine/Tests/Models/CMS/CmsEmail.php | 4 +- tests/Doctrine/Tests/Models/CMS/CmsGroup.php | 2 +- .../Tests/Models/CMS/CmsPhonenumber.php | 2 +- tests/Doctrine/Tests/Models/CMS/CmsUser.php | 12 +- .../Tests/Models/Company/CompanyAuction.php | 4 +- .../Tests/Models/Company/CompanyCar.php | 6 +- .../Tests/Models/Company/CompanyContract.php | 4 +- .../Tests/Models/Company/CompanyEmployee.php | 2 +- .../Tests/Models/Company/CompanyEvent.php | 8 +- .../Tests/Models/Company/CompanyManager.php | 6 +- .../Models/Company/CompanyOrganization.php | 14 +- .../Tests/Models/Company/CompanyPerson.php | 8 +- .../Tests/Models/Company/CompanyRaffle.php | 4 +- .../Tests/Models/DDC117/DDC117Article.php | 2 +- .../DDC1476EntityWithDefaultFieldType.php | 14 +- .../Models/DDC753/DDC753CustomRepository.php | 2 +- .../Models/DDC753/DDC753DefaultRepository.php | 2 +- .../DDC753EntityWithCustomRepository.php | 4 +- ...DC753EntityWithDefaultCustomRepository.php | 4 +- .../DDC753EntityWithInvalidRepository.php | 4 +- .../Models/DDC869/DDC869ChequePayment.php | 2 +- .../Models/DDC869/DDC869CreditCardPayment.php | 2 +- .../Tests/Models/DDC869/DDC869Payment.php | 8 +- .../Models/DDC869/DDC869PaymentRepository.php | 4 +- .../DirectoryTree/AbstractContentItem.php | 2 +- .../Tests/Models/ECommerce/ECommerceCart.php | 12 +- .../Models/ECommerce/ECommerceCustomer.php | 14 +- .../Models/ECommerce/ECommerceFeature.php | 10 +- .../Models/ECommerce/ECommerceProduct.php | 2 +- .../Doctrine/Tests/Models/Forum/ForumUser.php | 8 +- .../Tests/ORM/CommitOrderCalculatorTest.php | 10 +- .../Tests/ORM/Criteria/DqlGenerationTest.php | 2 +- .../Tests/ORM/Entity/ConstructorTest.php | 4 +- .../Doctrine/Tests/ORM/EntityManagerTest.php | 4 +- .../Functional/AdvancedAssociationTest.php | 134 +++++------ .../ORM/Functional/BasicFunctionalTest.php | 144 ++++++------ .../Functional/ClassTableInheritanceTest.php | 98 ++++---- .../Functional/ClassTableInheritanceTest2.php | 40 ++-- .../Functional/CompositePrimaryKeyTest.php | 6 +- .../ORM/Functional/DefaultValuesTest.php | 18 +- .../ORM/Functional/DetachedEntityTest.php | 14 +- .../Functional/ExtraLazyCollectionTest.php | 2 +- .../Tests/ORM/Functional/FlushEventTest.php | 28 +-- .../Tests/ORM/Functional/IdentityMapTest.php | 122 +++++----- .../ORM/Functional/LifecycleCallbackTest.php | 48 ++-- .../Functional/Locking/GearmanLockTest.php | 2 +- .../ORM/Functional/Locking/OptimisticTest.php | 8 +- .../ManyToManyBasicAssociationTest.php | 62 ++--- ...ManyToManyBidirectionalAssociationTest.php | 34 +-- ...nyToManySelfReferentialAssociationTest.php | 16 +- ...anyToManyUnidirectionalAssociationTest.php | 10 +- .../OneToManyBidirectionalAssociationTest.php | 28 +-- ...neToManySelfReferentialAssociationTest.php | 12 +- .../OneToOneBidirectionalAssociationTest.php | 36 +-- .../Functional/OneToOneEagerLoadingTest.php | 2 +- .../Functional/OneToOneOrphanRemovalTest.php | 48 ++-- ...OneToOneSelfReferentialAssociationTest.php | 26 +- .../OneToOneUnidirectionalAssociationTest.php | 16 +- .../ORM/Functional/OrderedCollectionTest.php | 2 +- ...edJoinedTableInheritanceCollectionTest.php | 6 +- .../PostgreSQLIdentityStrategyTest.php | 4 +- .../Tests/ORM/Functional/QueryCacheTest.php | 10 +- .../ORM/Functional/QueryDqlFunctionTest.php | 10 +- .../Tests/ORM/Functional/ResultCacheTest.php | 12 +- .../ORM/Functional/SchemaTool/DDC214Test.php | 2 +- .../SchemaTool/MySqlSchemaToolTest.php | 10 +- .../StandardEntityPersisterTest.php | 30 +-- .../ORM/Functional/Ticket/DDC1041Test.php | 8 +- .../ORM/Functional/Ticket/DDC1050Test.php | 4 +- .../ORM/Functional/Ticket/DDC1080Test.php | 22 +- .../ORM/Functional/Ticket/DDC1163Test.php | 8 +- .../ORM/Functional/Ticket/DDC117Test.php | 2 +- .../ORM/Functional/Ticket/DDC1181Test.php | 12 +- .../ORM/Functional/Ticket/DDC1193Test.php | 2 +- .../ORM/Functional/Ticket/DDC1276Test.php | 2 +- .../ORM/Functional/Ticket/DDC1383Test.php | 20 +- .../ORM/Functional/Ticket/DDC1404Test.php | 36 +-- .../ORM/Functional/Ticket/DDC1430Test.php | 102 ++++---- .../ORM/Functional/Ticket/DDC144Test.php | 10 +- .../ORM/Functional/Ticket/DDC1458Test.php | 4 +- .../ORM/Functional/Ticket/DDC1461Test.php | 2 +- .../ORM/Functional/Ticket/DDC1509Test.php | 4 +- .../ORM/Functional/Ticket/DDC1514Test.php | 222 +++++++++--------- .../ORM/Functional/Ticket/DDC1548Test.php | 2 +- .../ORM/Functional/Ticket/DDC168Test.php | 4 +- .../ORM/Functional/Ticket/DDC192Test.php | 20 +- .../ORM/Functional/Ticket/DDC199Test.php | 22 +- .../ORM/Functional/Ticket/DDC211Test.php | 6 +- .../ORM/Functional/Ticket/DDC237Test.php | 26 +- .../ORM/Functional/Ticket/DDC258Test.php | 6 +- .../ORM/Functional/Ticket/DDC279Test.php | 6 +- .../ORM/Functional/Ticket/DDC345Test.php | 2 +- .../ORM/Functional/Ticket/DDC353Test.php | 2 +- .../ORM/Functional/Ticket/DDC371Test.php | 12 +- .../ORM/Functional/Ticket/DDC381Test.php | 4 +- .../ORM/Functional/Ticket/DDC422Test.php | 8 +- .../ORM/Functional/Ticket/DDC425Test.php | 2 +- .../ORM/Functional/Ticket/DDC440Test.php | 10 +- .../ORM/Functional/Ticket/DDC444Test.php | 6 +- .../ORM/Functional/Ticket/DDC501Test.php | 2 +- .../ORM/Functional/Ticket/DDC512Test.php | 2 +- .../ORM/Functional/Ticket/DDC522Test.php | 4 +- .../ORM/Functional/Ticket/DDC531Test.php | 2 +- .../ORM/Functional/Ticket/DDC618Test.php | 2 +- .../ORM/Functional/Ticket/DDC633Test.php | 6 +- .../ORM/Functional/Ticket/DDC656Test.php | 2 +- .../ORM/Functional/Ticket/DDC729Test.php | 4 +- .../ORM/Functional/Ticket/DDC736Test.php | 6 +- .../ORM/Functional/Ticket/DDC767Test.php | 2 +- .../ORM/Functional/Ticket/DDC809Test.php | 2 +- .../ORM/Functional/Ticket/DDC812Test.php | 4 +- .../ORM/Functional/Ticket/DDC832Test.php | 2 +- .../ORM/Functional/Ticket/DDC849Test.php | 36 +-- .../ORM/Functional/Ticket/DDC881Test.php | 2 +- .../Tests/ORM/Functional/Ticket/Ticket69.php | 2 +- .../Tests/ORM/Functional/TypeValueSqlTest.php | 4 +- .../ORM/Hydration/ResultSetMappingTest.php | 12 +- .../Tests/ORM/Id/AssignedGeneratorTest.php | 4 +- .../ORM/Mapping/AbstractMappingDriverTest.php | 18 +- .../ORM/Mapping/AnnotationDriverTest.php | 28 +-- .../Mapping/BasicInheritanceMappingTest.php | 66 +++--- .../ORM/Mapping/ClassMetadataFactoryTest.php | 12 +- .../Mapping/ClassMetadataLoadEventTest.php | 2 +- .../Tests/ORM/Mapping/ClassMetadataTest.php | 10 +- .../Tests/ORM/Mapping/DriverChainTest.php | 6 +- .../ORM/Mapping/XmlMappingDriverTest.php | 2 +- .../php/Doctrine.Tests.ORM.Mapping.User.php | 22 +- .../Performance/HydrationPerformanceTest.php | 6 +- .../ORM/Performance/InsertPerformanceTest.php | 6 +- .../Performance/UnitOfWorkPerformanceTest.php | 2 +- .../Tests/ORM/PersistentCollectionTest.php | 2 +- .../BasicEntityPersisterTypeValueSqlTest.php | 4 +- .../ORM/Query/LanguageRecognitionTest.php | 54 ++--- tests/Doctrine/Tests/ORM/Query/LexerTest.php | 2 +- tests/Doctrine/Tests/ORM/QueryBuilderTest.php | 90 +++---- .../Tests/ORM/Tools/EntityGeneratorTest.php | 6 +- .../AbstractClassMetadataExporterTest.php | 12 +- .../Doctrine.Tests.ORM.Tools.Export.User.php | 22 +- .../Tools/ResolveTargetEntityListenerTest.php | 4 +- tests/Doctrine/Tests/ORM/Tools/SetupTest.php | 36 +-- tests/Doctrine/Tests/ORM/UnitOfWorkTest.php | 28 +-- .../Doctrine/Tests/OrmFunctionalTestCase.php | 28 +-- tests/Doctrine/Tests/OrmTestCase.php | 26 +- tests/NativePhpunitTask.php | 2 +- 268 files changed, 1724 insertions(+), 1724 deletions(-) diff --git a/lib/Doctrine/ORM/AbstractQuery.php b/lib/Doctrine/ORM/AbstractQuery.php index 7010136c8..3fe27f93b 100644 --- a/lib/Doctrine/ORM/AbstractQuery.php +++ b/lib/Doctrine/ORM/AbstractQuery.php @@ -616,7 +616,7 @@ abstract class AbstractQuery $this->_queryCacheProfile = $this->_queryCacheProfile ? $this->_queryCacheProfile->setCacheKey($id) : new QueryCacheProfile(0, $id); - + return $this; } diff --git a/lib/Doctrine/ORM/Configuration.php b/lib/Doctrine/ORM/Configuration.php index cddc8672c..83b4dc5dd 100644 --- a/lib/Doctrine/ORM/Configuration.php +++ b/lib/Doctrine/ORM/Configuration.php @@ -523,14 +523,14 @@ class Configuration extends \Doctrine\DBAL\Configuration /** * Set default repository class. - * + * * @since 2.2 * @param string $className * @throws ORMException If not is a \Doctrine\ORM\EntityRepository */ public function setDefaultRepositoryClassName($className) { - if ($className != "Doctrine\ORM\EntityRepository" && + if ($className != "Doctrine\ORM\EntityRepository" && !is_subclass_of($className, 'Doctrine\ORM\EntityRepository')){ throw ORMException::invalidEntityRepository($className); } @@ -539,7 +539,7 @@ class Configuration extends \Doctrine\DBAL\Configuration /** * Get default repository class. - * + * * @since 2.2 * @return string */ diff --git a/lib/Doctrine/ORM/Event/LifecycleEventArgs.php b/lib/Doctrine/ORM/Event/LifecycleEventArgs.php index 320b03572..6740a3e12 100644 --- a/lib/Doctrine/ORM/Event/LifecycleEventArgs.php +++ b/lib/Doctrine/ORM/Event/LifecycleEventArgs.php @@ -42,10 +42,10 @@ class LifecycleEventArgs extends EventArgs * @var object */ private $entity; - + /** * Constructor - * + * * @param object $entity * @param \Doctrine\ORM\EntityManager $em */ @@ -54,11 +54,11 @@ class LifecycleEventArgs extends EventArgs $this->entity = $entity; $this->em = $em; } - + /** * Retireve associated Entity. - * - * @return object + * + * @return object */ public function getEntity() { @@ -67,7 +67,7 @@ class LifecycleEventArgs extends EventArgs /** * Retrieve associated EntityManager. - * + * * @return \Doctrine\ORM\EntityManager */ public function getEntityManager() diff --git a/lib/Doctrine/ORM/Event/LoadClassMetadataEventArgs.php b/lib/Doctrine/ORM/Event/LoadClassMetadataEventArgs.php index 2cd25933b..901bf3a78 100644 --- a/lib/Doctrine/ORM/Event/LoadClassMetadataEventArgs.php +++ b/lib/Doctrine/ORM/Event/LoadClassMetadataEventArgs.php @@ -43,7 +43,7 @@ class LoadClassMetadataEventArgs extends EventArgs /** * Constructor. - * + * * @param \Doctrine\ORM\Mapping\ClassMetadataInfo $classMetadata * @param \Doctrine\ORM\EntityManager $em */ @@ -55,7 +55,7 @@ class LoadClassMetadataEventArgs extends EventArgs /** * Retrieve associated ClassMetadata. - * + * * @return \Doctrine\ORM\Mapping\ClassMetadataInfo */ public function getClassMetadata() @@ -65,7 +65,7 @@ class LoadClassMetadataEventArgs extends EventArgs /** * Retrieve associated EntityManager. - * + * * @return \Doctrine\ORM\EntityManager */ public function getEntityManager() diff --git a/lib/Doctrine/ORM/Event/OnClearEventArgs.php b/lib/Doctrine/ORM/Event/OnClearEventArgs.php index 07f5c4711..542ac45e3 100644 --- a/lib/Doctrine/ORM/Event/OnClearEventArgs.php +++ b/lib/Doctrine/ORM/Event/OnClearEventArgs.php @@ -42,7 +42,7 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs /** * Constructor. - * + * * @param \Doctrine\ORM\EntityManager $em * @param string $entityClass Optional entity class */ @@ -54,7 +54,7 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs /** * Retrieve associated EntityManager. - * + * * @return \Doctrine\ORM\EntityManager */ public function getEntityManager() diff --git a/lib/Doctrine/ORM/Event/OnFlushEventArgs.php b/lib/Doctrine/ORM/Event/OnFlushEventArgs.php index fd8545b21..c4aeb2a16 100644 --- a/lib/Doctrine/ORM/Event/OnFlushEventArgs.php +++ b/lib/Doctrine/ORM/Event/OnFlushEventArgs.php @@ -38,13 +38,13 @@ class OnFlushEventArgs extends \Doctrine\Common\EventArgs * @var Doctirne\ORM\EntityManager */ private $em; - + //private $entitiesToPersist = array(); //private $entitiesToRemove = array(); - + /** * Constructor. - * + * * @param \Doctrine\ORM\EntityManager $em */ public function __construct(EntityManager $em) @@ -54,30 +54,30 @@ class OnFlushEventArgs extends \Doctrine\Common\EventArgs /** * Retrieve associated EntityManager. - * + * * @return \Doctrine\ORM\EntityManager */ public function getEntityManager() { return $this->em; } - + /* public function addEntityToPersist($entity) { - + } - + public function addEntityToRemove($entity) { - + } - + public function addEntityToUpdate($entity) { - + } - + public function getEntitiesToPersist() { return $this->_entitiesToPersist; diff --git a/lib/Doctrine/ORM/Event/PostFlushEventArgs.php b/lib/Doctrine/ORM/Event/PostFlushEventArgs.php index e10d600df..f45030de7 100644 --- a/lib/Doctrine/ORM/Event/PostFlushEventArgs.php +++ b/lib/Doctrine/ORM/Event/PostFlushEventArgs.php @@ -41,7 +41,7 @@ class PostFlushEventArgs extends EventArgs /** * Constructor. - * + * * @param \Doctrine\ORM\EntityManager $em */ public function __construct(EntityManager $em) @@ -51,7 +51,7 @@ class PostFlushEventArgs extends EventArgs /** * Retrieve associated EntityManager. - * + * * @return \Doctrine\ORM\EntityManager */ public function getEntityManager() diff --git a/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php b/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php index 4d7e3ef38..0bebba1c8 100644 --- a/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php +++ b/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php @@ -41,7 +41,7 @@ class PreUpdateEventArgs extends LifecycleEventArgs /** * Constructor. - * + * * @param object $entity * @param \Doctrine\ORM\EntityManager $em * @param array $changeSet @@ -49,13 +49,13 @@ class PreUpdateEventArgs extends LifecycleEventArgs public function __construct($entity, EntityManager $em, array &$changeSet) { parent::__construct($entity, $em); - + $this->entityChangeSet = &$changeSet; } /** * Retrieve entity changeset. - * + * * @return array */ public function getEntityChangeSet() @@ -75,7 +75,7 @@ class PreUpdateEventArgs extends LifecycleEventArgs /** * Get the old value of the changeset of the changed field. - * + * * @param string $field * @return mixed */ @@ -101,7 +101,7 @@ class PreUpdateEventArgs extends LifecycleEventArgs /** * Set the new value of this field. - * + * * @param string $field * @param mixed $value */ @@ -114,8 +114,8 @@ class PreUpdateEventArgs extends LifecycleEventArgs /** * Assert the field exists in changeset. - * - * @param string $field + * + * @param string $field */ private function assertValidField($field) { diff --git a/lib/Doctrine/ORM/Events.php b/lib/Doctrine/ORM/Events.php index 8af7a9b61..45424e7c2 100644 --- a/lib/Doctrine/ORM/Events.php +++ b/lib/Doctrine/ORM/Events.php @@ -35,55 +35,55 @@ final class Events /** * The preRemove event occurs for a given entity before the respective * EntityManager remove operation for that entity is executed. - * + * * This is an entity lifecycle event. - * + * * @var string */ const preRemove = 'preRemove'; /** - * The postRemove event occurs for an entity after the entity has + * The postRemove event occurs for an entity after the entity has * been deleted. It will be invoked after the database delete operations. - * + * * This is an entity lifecycle event. - * + * * @var string */ const postRemove = 'postRemove'; /** * The prePersist event occurs for a given entity before the respective * EntityManager persist operation for that entity is executed. - * + * * This is an entity lifecycle event. - * + * * @var string */ const prePersist = 'prePersist'; /** - * The postPersist event occurs for an entity after the entity has + * The postPersist event occurs for an entity after the entity has * been made persistent. It will be invoked after the database insert operations. * Generated primary key values are available in the postPersist event. - * + * * This is an entity lifecycle event. - * + * * @var string */ const postPersist = 'postPersist'; /** - * The preUpdate event occurs before the database update operations to - * entity data. - * + * The preUpdate event occurs before the database update operations to + * entity data. + * * This is an entity lifecycle event. - * + * * @var string */ const preUpdate = 'preUpdate'; /** - * The postUpdate event occurs after the database update operations to - * entity data. - * + * The postUpdate event occurs after the database update operations to + * entity data. + * * This is an entity lifecycle event. - * + * * @var string */ const postUpdate = 'postUpdate'; @@ -91,24 +91,24 @@ final class Events * The postLoad event occurs for an entity after the entity has been loaded * into the current EntityManager from the database or after the refresh operation * has been applied to it. - * + * * Note that the postLoad event occurs for an entity before any associations have been * initialized. Therefore it is not safe to access associations in a postLoad callback * or event handler. - * + * * This is an entity lifecycle event. - * + * * @var string */ const postLoad = 'postLoad'; /** * The loadClassMetadata event occurs after the mapping metadata for a class * has been loaded from a mapping source (annotations/xml/yaml). - * + * * @var string */ const loadClassMetadata = 'loadClassMetadata'; - + /** * The preFlush event occurs when the EntityManager#flush() operation is invoked, * but before any changes to managed entites have been calculated. This event is @@ -122,7 +122,7 @@ final class Events * actual database operations are executed. The event is only raised if there is * actually something to do for the underlying UnitOfWork. If nothing needs to be done, * the onFlush event is not raised. - * + * * @var string */ const onFlush = 'onFlush'; @@ -133,11 +133,11 @@ final class Events * actually something to do for the underlying UnitOfWork. If nothing needs to be done, * the postFlush event is not raised. The event won't be raised if an error occurs during the * flush operation. - * + * * @var string */ const postFlush = 'postFlush'; - + /** * The onClear event occurs when the EntityManager#clear() operation is invoked, * after all references to entities have been removed from the unit of work. diff --git a/lib/Doctrine/ORM/Id/AbstractIdGenerator.php b/lib/Doctrine/ORM/Id/AbstractIdGenerator.php index 677238289..d27c00b77 100644 --- a/lib/Doctrine/ORM/Id/AbstractIdGenerator.php +++ b/lib/Doctrine/ORM/Id/AbstractIdGenerator.php @@ -35,7 +35,7 @@ abstract class AbstractIdGenerator * Gets whether this generator is a post-insert generator which means that * {@link generate()} must be called after the entity has been inserted * into the database. - * + * * By default, this method returns FALSE. Generators that have this requirement * must override this method and return TRUE. * diff --git a/lib/Doctrine/ORM/Id/AssignedGenerator.php b/lib/Doctrine/ORM/Id/AssignedGenerator.php index 2e2d4f2f6..c9f9adad8 100644 --- a/lib/Doctrine/ORM/Id/AssignedGenerator.php +++ b/lib/Doctrine/ORM/Id/AssignedGenerator.php @@ -46,14 +46,14 @@ class AssignedGenerator extends AbstractIdGenerator $class = $em->getClassMetadata(get_class($entity)); $idFields = $class->getIdentifierFieldNames(); $identifier = array(); - + foreach ($idFields as $idField) { $value = $class->reflFields[$idField]->getValue($entity); - + if ( ! isset($value)) { throw ORMException::entityMissingAssignedIdForField($entity, $idField); } - + if (isset($class->associationMappings[$idField])) { if ( ! $em->getUnitOfWork()->isInIdentityMap($value)) { throw ORMException::entityMissingForeignAssignedId($entity, $value); @@ -62,10 +62,10 @@ class AssignedGenerator extends AbstractIdGenerator // NOTE: Single Columns as associated identifiers only allowed - this constraint it is enforced. $value = current($em->getUnitOfWork()->getEntityIdentifier($value)); } - + $identifier[$idField] = $value; } - + return $identifier; } } diff --git a/lib/Doctrine/ORM/Id/TableGenerator.php b/lib/Doctrine/ORM/Id/TableGenerator.php index 5c49344fe..24b1d90e5 100644 --- a/lib/Doctrine/ORM/Id/TableGenerator.php +++ b/lib/Doctrine/ORM/Id/TableGenerator.php @@ -50,12 +50,12 @@ class TableGenerator extends AbstractIdGenerator if ($this->_maxValue === null || $this->_nextValue == $this->_maxValue) { // Allocate new values $conn = $em->getConnection(); - + if ($conn->getTransactionNestingLevel() === 0) { // use select for update $sql = $conn->getDatabasePlatform()->getTableHiLoCurrentValSql($this->_tableName, $this->_sequenceName); $currentLevel = $conn->fetchColumn($sql); - + if ($currentLevel != null) { $this->_nextValue = $currentLevel; $this->_maxValue = $this->_nextValue + $this->_allocationSize; @@ -63,7 +63,7 @@ class TableGenerator extends AbstractIdGenerator $updateSql = $conn->getDatabasePlatform()->getTableHiLoUpdateNextValSql( $this->_tableName, $this->_sequenceName, $this->_allocationSize ); - + if ($conn->executeUpdate($updateSql, array(1 => $currentLevel, 2 => $currentLevel+1)) !== 1) { // no affected rows, concurrency issue, throw exception } @@ -75,7 +75,7 @@ class TableGenerator extends AbstractIdGenerator // or do we want to work with table locks exclusively? } } - + return $this->_nextValue++; } } \ No newline at end of file diff --git a/lib/Doctrine/ORM/Internal/CommitOrderCalculator.php b/lib/Doctrine/ORM/Internal/CommitOrderCalculator.php index aad34e993..049cab060 100644 --- a/lib/Doctrine/ORM/Internal/CommitOrderCalculator.php +++ b/lib/Doctrine/ORM/Internal/CommitOrderCalculator.php @@ -24,7 +24,7 @@ namespace Doctrine\ORM\Internal; * correct order in which changes to entities need to be persisted. * * @since 2.0 - * @author Roman Borschel + * @author Roman Borschel * @author Guilherme Blanco */ class CommitOrderCalculator @@ -32,12 +32,12 @@ class CommitOrderCalculator const NOT_VISITED = 1; const IN_PROGRESS = 2; const VISITED = 3; - + private $_nodeStates = array(); private $_classes = array(); // The nodes to sort private $_relatedClasses = array(); private $_sorted = array(); - + /** * Clears the current graph. * @@ -48,10 +48,10 @@ class CommitOrderCalculator $this->_classes = $this->_relatedClasses = array(); } - + /** * Gets a valid commit order for all current nodes. - * + * * Uses a depth-first search (DFS) to traverse the graph. * The desired topological sorting is the reverse postorder of these searches. * @@ -65,12 +65,12 @@ class CommitOrderCalculator if ($nodeCount <= 1) { return ($nodeCount == 1) ? array_values($this->_classes) : array(); } - + // Init foreach ($this->_classes as $node) { $this->_nodeStates[$node->name] = self::NOT_VISITED; } - + // Go foreach ($this->_classes as $node) { if ($this->_nodeStates[$node->name] == self::NOT_VISITED) { @@ -100,17 +100,17 @@ class CommitOrderCalculator $this->_nodeStates[$node->name] = self::VISITED; $this->_sorted[] = $node; } - + public function addDependency($fromClass, $toClass) { $this->_relatedClasses[$fromClass->name][] = $toClass; } - + public function hasClass($className) { return isset($this->_classes[$className]); } - + public function addClass($class) { $this->_classes[$class->name] = $class; diff --git a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php index 1935e901d..838e9ef8c 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php @@ -233,20 +233,20 @@ class ObjectHydrator extends AbstractHydrator } $this->_hints['fetchAlias'] = $dqlAlias; - + $entity = $this->_uow->createEntity($className, $data, $this->_hints); - + //TODO: These should be invoked later, after hydration, because associations may not yet be loaded here. if (isset($this->_ce[$className]->lifecycleCallbacks[Events::postLoad])) { $this->_ce[$className]->invokeLifecycleCallbacks(Events::postLoad, $entity); } - + $evm = $this->_em->getEventManager(); if ($evm->hasListeners(Events::postLoad)) { $evm->dispatchEvent(Events::postLoad, new LifecycleEventArgs($entity, $this->_em)); } - + return $entity; } diff --git a/lib/Doctrine/ORM/Internal/Hydration/ScalarHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/ScalarHydrator.php index 29c0d12e5..d02651b29 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/ScalarHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/ScalarHydrator.php @@ -32,22 +32,22 @@ use Doctrine\DBAL\Connection; */ class ScalarHydrator extends AbstractHydrator { - /** + /** * {@inheritdoc} */ protected function hydrateAllData() { $result = array(); $cache = array(); - + while ($data = $this->_stmt->fetch(\PDO::FETCH_ASSOC)) { $this->hydrateRowData($data, $cache, $result); } - + return $result; } - /** + /** * {@inheritdoc} */ protected function hydrateRowData(array $data, array &$cache, array &$result) diff --git a/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php index a4770f28e..648f64979 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php @@ -63,18 +63,18 @@ class SimpleObjectHydrator extends AbstractHydrator if (count($this->_rsm->aliasMap) !== 1) { throw new \RuntimeException("Cannot use SimpleObjectHydrator with a ResultSetMapping that contains more than one object result."); } - + if ($this->_rsm->scalarMappings) { throw new \RuntimeException("Cannot use SimpleObjectHydrator with a ResultSetMapping that contains scalar mappings."); } - + $this->class = $this->_em->getClassMetadata(reset($this->_rsm->aliasMap)); - + // We only need to add declaring classes if we have inheritance. if ($this->class->inheritanceType === ClassMetadata::INHERITANCE_TYPE_NONE) { return; } - + foreach ($this->_rsm->declaringClasses AS $column => $class) { $this->declaringClasses[$column] = $this->_em->getClassMetadata($class); } @@ -87,27 +87,27 @@ class SimpleObjectHydrator extends AbstractHydrator { $entityName = $this->class->name; $data = array(); - + // We need to find the correct entity class name if we have inheritance in resultset if ($this->class->inheritanceType !== ClassMetadata::INHERITANCE_TYPE_NONE) { $discrColumnName = $this->_platform->getSQLResultCasing($this->class->discriminatorColumn['name']); - + if ($sqlResult[$discrColumnName] === '') { throw HydrationException::emptyDiscriminatorValue(key($this->_rsm->aliasMap)); } $entityName = $this->class->discriminatorMap[$sqlResult[$discrColumnName]]; - + unset($sqlResult[$discrColumnName]); } - + foreach ($sqlResult as $column => $value) { // Hydrate column information if not yet present if ( ! isset($cache[$column])) { if (($info = $this->hydrateColumnInfo($entityName, $column)) === null) { continue; } - + $cache[$column] = $info; } @@ -116,7 +116,7 @@ class SimpleObjectHydrator extends AbstractHydrator $type = Type::getType($cache[$column]['class']->fieldMappings[$cache[$column]['name']]['type']); $value = $type->convertToPHPValue($value, $this->_platform); } - + // Prevent overwrite in case of inherit classes using same property name (See AbstractHydrator) if (isset($cache[$column]) && ( ! isset($data[$cache[$column]['name']]) || $value !== null)) { $data[$cache[$column]['name']] = $value; @@ -129,7 +129,7 @@ class SimpleObjectHydrator extends AbstractHydrator $uow = $this->_em->getUnitOfWork(); $entity = $uow->createEntity($entityName, $data, $this->_hints); - + //TODO: These should be invoked later, after hydration, because associations may not yet be loaded here. if (isset($this->class->lifecycleCallbacks[Events::postLoad])) { $this->class->invokeLifecycleCallbacks(Events::postLoad, $entity); @@ -140,24 +140,24 @@ class SimpleObjectHydrator extends AbstractHydrator if ($evm->hasListeners(Events::postLoad)) { $evm->dispatchEvent(Events::postLoad, new LifecycleEventArgs($entity, $this->_em)); } - + $result[] = $entity; } - + /** * Retrieve column information form ResultSetMapping. - * + * * @param string $entityName * @param string $column - * - * @return array + * + * @return array */ protected function hydrateColumnInfo($entityName, $column) { switch (true) { case (isset($this->_rsm->fieldMappings[$column])): - $class = isset($this->declaringClasses[$column]) - ? $this->declaringClasses[$column] + $class = isset($this->declaringClasses[$column]) + ? $this->declaringClasses[$column] : $this->class; // If class is not part of the inheritance, ignore @@ -172,8 +172,8 @@ class SimpleObjectHydrator extends AbstractHydrator ); case (isset($this->_rsm->relationMap[$column])): - $class = isset($this->_rsm->relationMap[$column]) - ? $this->_rsm->relationMap[$column] + $class = isset($this->_rsm->relationMap[$column]) + ? $this->_rsm->relationMap[$column] : $this->class; // If class is not self referencing, ignore @@ -181,7 +181,7 @@ class SimpleObjectHydrator extends AbstractHydrator return null; } - // TODO: Decide what to do with associations. It seems original code is incomplete. + // TODO: Decide what to do with associations. It seems original code is incomplete. // One solution is to load the association, but it might require extra efforts. return array('name' => $column); diff --git a/lib/Doctrine/ORM/Internal/Hydration/SingleScalarHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/SingleScalarHydrator.php index 98a45960e..a5dabc60c 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/SingleScalarHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/SingleScalarHydrator.php @@ -33,24 +33,24 @@ use Doctrine\DBAL\Connection, class SingleScalarHydrator extends AbstractHydrator { /** - * {@inheritdoc} + * {@inheritdoc} */ protected function hydrateAllData() { $data = $this->_stmt->fetchAll(\PDO::FETCH_ASSOC); $numRows = count($data); - + if ($numRows === 0) { throw new NoResultException(); } - + if ($numRows > 1 || count($data[key($data)]) > 1) { throw new NonUniqueResultException(); } - + $cache = array(); $result = $this->gatherScalarRowData($data[key($data)], $cache); - + return array_shift($result); } } \ No newline at end of file diff --git a/lib/Doctrine/ORM/Mapping/Builder/AssociationBuilder.php b/lib/Doctrine/ORM/Mapping/Builder/AssociationBuilder.php index cff4e5d52..843e2ce5d 100644 --- a/lib/Doctrine/ORM/Mapping/Builder/AssociationBuilder.php +++ b/lib/Doctrine/ORM/Mapping/Builder/AssociationBuilder.php @@ -124,7 +124,7 @@ class AssociationBuilder /** * Add Join Columns - * + * * @param string $columnName * @param string $referencedColumnName * @param bool $nullable diff --git a/lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php b/lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php index 3765fbd93..fb1f1d5e5 100644 --- a/lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php +++ b/lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php @@ -62,7 +62,7 @@ class ClassMetadataBuilder public function setMappedSuperClass() { $this->cm->isMappedSuperclass = true; - + return $this; } diff --git a/lib/Doctrine/ORM/Mapping/Builder/FieldBuilder.php b/lib/Doctrine/ORM/Mapping/Builder/FieldBuilder.php index 9278a6db0..3f4a5bbaf 100644 --- a/lib/Doctrine/ORM/Mapping/Builder/FieldBuilder.php +++ b/lib/Doctrine/ORM/Mapping/Builder/FieldBuilder.php @@ -170,7 +170,7 @@ class FieldBuilder /** * Set Sequence Generator - * + * * @param string $sequenceName * @param int $allocationSize * @param int $initialValue @@ -188,7 +188,7 @@ class FieldBuilder /** * Set column definition. - * + * * @param string $def * @return FieldBuilder */ diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadata.php b/lib/Doctrine/ORM/Mapping/ClassMetadata.php index 4e31f5578..b6c31c52d 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadata.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadata.php @@ -358,7 +358,7 @@ class ClassMetadata extends ClassMetadataInfo implements IClassMetadata ($this->reflClass->getMethod($callback)->getModifiers() & \ReflectionMethod::IS_PUBLIC) == 0) { throw MappingException::lifecycleCallbackMethodNotFound($this->name, $callback); } - + return parent::addLifecycleCallback($callback, $event); } } diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php index 8801344ff..bf802ecf9 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php @@ -43,7 +43,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface * @var EntityManager */ private $em; - + /** * @var AbstractPlatform */ @@ -73,7 +73,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface * @var bool */ private $initialized = false; - + /** * @param EntityManager $$em */ @@ -101,16 +101,16 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface { return $this->cacheDriver; } - + public function getLoadedMetadata() { return $this->loadedMetadata; } - + /** * Forces the factory to load the metadata of all classes known to the underlying * mapping driver. - * + * * @return array The ClassMetadata instances of all mapped classes. */ public function getAllMetadata() @@ -188,7 +188,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface /** * Checks whether the factory has the metadata for a class loaded already. - * + * * @param string $className * @return boolean TRUE if the metadata of the class in question is already loaded, FALSE otherwise. */ @@ -199,7 +199,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface /** * Sets the metadata descriptor for a specific class. - * + * * NOTE: This is only useful in very special cases, like when generating proxy classes. * * @param string $className @@ -308,11 +308,11 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface if ($parent && $parent->isInheritanceTypeSingleTable()) { $class->setPrimaryTable($parent->table); } - + if ($parent && $parent->containsForeignIdentifier) { $class->containsForeignIdentifier = true; } - + if ($parent && !empty ($parent->namedQueries)) { $this->addInheritedNamedQueries($class, $parent); } @@ -325,7 +325,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface } $this->validateRuntimeMetadata($class, $parent); - + $this->loadedMetadata[$className] = $class; $parent = $class; @@ -436,10 +436,10 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface $subClass->addInheritedAssociationMapping($mapping); } } - + /** * Adds inherited named queries to the subclass mapping. - * + * * @since 2.2 * @param \Doctrine\ORM\Mapping\ClassMetadata $subClass * @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass @@ -524,13 +524,13 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface if ( ! $this->initialized) { $this->initialize(); } - + // Check for namespace alias if (strpos($class, ':') !== false) { list($namespaceAlias, $simpleClassName) = explode(':', $class); $class = $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName; } - + return $this->driver->isTransient($class); } } diff --git a/lib/Doctrine/ORM/Mapping/Driver/AbstractFileDriver.php b/lib/Doctrine/ORM/Mapping/Driver/AbstractFileDriver.php index a92432db8..6953bf2d1 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/AbstractFileDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/AbstractFileDriver.php @@ -25,7 +25,7 @@ use Doctrine\ORM\Mapping\MappingException; /** * Base driver for file-based metadata drivers. - * + * * A file driver operates in a mode where it loads the mapping files of individual * classes on demand. This requires the user to adhere to the convention of 1 mapping * file per class and the file names of the mapping files must correspond to the full @@ -56,16 +56,16 @@ abstract class AbstractFileDriver implements Driver */ protected $_fileExtension; - /** - * Initializes a new FileDriver that looks in the given path(s) for mapping - * documents and operates in the specified operating mode. - * - * @param string|array $paths One or multiple paths where mapping documents can be found. - */ - public function __construct($paths) - { + /** + * Initializes a new FileDriver that looks in the given path(s) for mapping + * documents and operates in the specified operating mode. + * + * @param string|array $paths One or multiple paths where mapping documents can be found. + */ + public function __construct($paths) + { $this->addPaths((array) $paths); - } + } /** * Append lookup paths to metadata driver. @@ -117,7 +117,7 @@ abstract class AbstractFileDriver implements Driver public function getElement($className) { $result = $this->_loadMappingFile($this->_findMappingFile($className)); - + if(!isset($result[$className])){ throw MappingException::invalidMappingFile($className, str_replace('\\', '.', $className) . $this->_fileExtension); } @@ -148,7 +148,7 @@ abstract class AbstractFileDriver implements Driver /** * Gets the names of all mapped classes known to this driver. - * + * * @return array The names of all mapped classes known to this driver. */ public function getAllClassNames() @@ -160,23 +160,23 @@ abstract class AbstractFileDriver implements Driver if ( ! is_dir($path)) { throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); } - + $iterator = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator($path), \RecursiveIteratorIterator::LEAVES_ONLY ); - + foreach ($iterator as $file) { if (($fileName = $file->getBasename($this->_fileExtension)) == $file->getBasename()) { continue; } - + // NOTE: All files found here means classes are not transient! $classes[] = str_replace('.', '\\', $fileName); } } } - + return $classes; } @@ -191,7 +191,7 @@ abstract class AbstractFileDriver implements Driver protected function _findMappingFile($className) { $fileName = str_replace('\\', '.', $className) . $this->_fileExtension; - + // Check whether file exists foreach ((array) $this->_paths as $path) { if (file_exists($path . DIRECTORY_SEPARATOR . $fileName)) { @@ -205,7 +205,7 @@ abstract class AbstractFileDriver implements Driver /** * Loads a mapping file with the given name and returns a map * from class/entity names to their corresponding elements. - * + * * @param string $file The mapping file to load. * @return array */ diff --git a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php index bee84159f..bcd453508 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php @@ -99,7 +99,7 @@ class AnnotationDriver implements Driver /** * Retrieve the current annotation reader - * + * * @return AnnotationReader */ public function getReader() @@ -519,15 +519,15 @@ class AnnotationDriver implements Driver new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY ), - '/^.+' . str_replace('.', '\.', $this->_fileExtension) . '$/i', + '/^.+' . str_replace('.', '\.', $this->_fileExtension) . '$/i', \RecursiveRegexIterator::GET_MATCH ); - + foreach ($iterator as $file) { $sourceFile = realpath($file[0]); - + require_once $sourceFile; - + $includedFiles[] = $sourceFile; } } diff --git a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php index c2d9240a2..2b73ed9fb 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php @@ -76,7 +76,7 @@ class DatabaseDriver implements Driver /** * Initializes a new AnnotationDriver that uses the given AnnotationReader for reading * docblock annotations. - * + * * @param AnnotationReader $reader The AnnotationReader to use. */ public function __construct(AbstractSchemaManager $schemaManager) @@ -111,7 +111,7 @@ class DatabaseDriver implements Driver } $tables = array(); - + foreach ($this->_sm->listTableNames() as $tableName) { $tables[$tableName] = $this->_sm->listTableDetails($tableName); } @@ -129,7 +129,7 @@ class DatabaseDriver implements Driver foreach ($foreignKeys AS $foreignKey) { $allForeignKeyColumns = array_merge($allForeignKeyColumns, $foreignKey->getLocalColumns()); } - + $pkColumns = $table->getPrimaryKey()->getColumns(); sort($pkColumns); sort($allForeignKeyColumns); @@ -145,7 +145,7 @@ class DatabaseDriver implements Driver } } } - + /** * {@inheritdoc} */ @@ -169,7 +169,7 @@ class DatabaseDriver implements Driver } catch(SchemaException $e) { $primaryKeyColumns = array(); } - + if ($this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints()) { $foreignKeys = $this->tables[$tableName]->getForeignKeys(); } else { diff --git a/lib/Doctrine/ORM/Mapping/Driver/Driver.php b/lib/Doctrine/ORM/Mapping/Driver/Driver.php index b6cfe36b4..28654a82b 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/Driver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/Driver.php @@ -34,18 +34,18 @@ interface Driver { /** * Loads the metadata for the specified class into the provided container. - * + * * @param string $className * @param ClassMetadataInfo $metadata */ function loadMetadataForClass($className, ClassMetadataInfo $metadata); - + /** * Gets the names of all mapped classes known to this driver. - * + * * @return array The names of all mapped classes known to this driver. */ - function getAllClassNames(); + function getAllClassNames(); /** * Whether the class with the specified name should have its metadata loaded. diff --git a/lib/Doctrine/ORM/Mapping/Driver/DriverChain.php b/lib/Doctrine/ORM/Mapping/Driver/DriverChain.php index d84d2344b..321962d2c 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/DriverChain.php +++ b/lib/Doctrine/ORM/Mapping/Driver/DriverChain.php @@ -94,7 +94,7 @@ class DriverChain implements Driver if (!isset($driverClasses[$oid])) { $driverClasses[$oid] = $driver->getAllClassNames(); } - + foreach ($driverClasses[$oid] AS $className) { if (strpos($className, $namespace) === 0) { $classNames[$className] = true; diff --git a/lib/Doctrine/ORM/Mapping/Driver/StaticPHPDriver.php b/lib/Doctrine/ORM/Mapping/Driver/StaticPHPDriver.php index 916113c1d..4e593ea8c 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/StaticPHPDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/StaticPHPDriver.php @@ -38,21 +38,21 @@ class StaticPHPDriver implements Driver { /** * Paths of entity directories. - * + * * @var array */ private $_paths = array(); - + /** * Map of all class names. - * + * * @var array */ private $_classNames; - + /** * The file extension of mapping documents. - * + * * @var string */ private $_fileExtension = '.php'; diff --git a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php index 5785ccf2c..7308a23e3 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php @@ -232,7 +232,7 @@ class XmlDriver extends AbstractFileDriver if (isset($idElement['column'])) { $mapping['columnName'] = (string)$idElement['column']; } - + if (isset($idElement['column-definition'])) { $mapping['columnDefinition'] = (string)$idElement['column-definition']; } diff --git a/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php index 4ef66f9f8..a65b6fb2f 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php @@ -181,7 +181,7 @@ class YamlDriver extends AbstractFileDriver if (isset($idElement['length'])) { $mapping['length'] = $idElement['length']; } - + if (isset($idElement['columnDefinition'])) { $mapping['columnDefinition'] = $idElement['columnDefinition']; } diff --git a/lib/Doctrine/ORM/Mapping/MappingException.php b/lib/Doctrine/ORM/Mapping/MappingException.php index cdc856381..babf4c98e 100644 --- a/lib/Doctrine/ORM/Mapping/MappingException.php +++ b/lib/Doctrine/ORM/Mapping/MappingException.php @@ -67,7 +67,7 @@ class MappingException extends \Doctrine\ORM\ORMException { return new self("No mapping file found named '$fileName' for class '$entityName'."); } - + public static function invalidMappingFile($entityName, $fileName) { return new self("Invalid mapping file '$fileName' for class '$entityName'."); diff --git a/lib/Doctrine/ORM/NoResultException.php b/lib/Doctrine/ORM/NoResultException.php index 80f08bb93..eb31f7cc9 100644 --- a/lib/Doctrine/ORM/NoResultException.php +++ b/lib/Doctrine/ORM/NoResultException.php @@ -21,7 +21,7 @@ namespace Doctrine\ORM; /** * Exception thrown when an ORM query unexpectedly does not return any results. - * + * * @author robo * @since 2.0 */ diff --git a/lib/Doctrine/ORM/NonUniqueResultException.php b/lib/Doctrine/ORM/NonUniqueResultException.php index 811df75c1..1a3a8b7eb 100644 --- a/lib/Doctrine/ORM/NonUniqueResultException.php +++ b/lib/Doctrine/ORM/NonUniqueResultException.php @@ -21,7 +21,7 @@ namespace Doctrine\ORM; /** * Exception thrown when an ORM query unexpectedly returns more than one result. - * + * * @author robo * @since 2.0 */ diff --git a/lib/Doctrine/ORM/ORMException.php b/lib/Doctrine/ORM/ORMException.php index 0e36217d9..bd16839f3 100644 --- a/lib/Doctrine/ORM/ORMException.php +++ b/lib/Doctrine/ORM/ORMException.php @@ -144,7 +144,7 @@ class ORMException extends Exception return new self("Invalid repository class '".$className."'. ". "it must be a Doctrine\ORM\EntityRepository."); } - + public static function missingIdentifierField($className, $fieldName) { return new self("The identifier $fieldName is missing for a query of " . $className); diff --git a/lib/Doctrine/ORM/Persisters/AbstractCollectionPersister.php b/lib/Doctrine/ORM/Persisters/AbstractCollectionPersister.php index 3ee81f0d4..7f8c40b09 100644 --- a/lib/Doctrine/ORM/Persisters/AbstractCollectionPersister.php +++ b/lib/Doctrine/ORM/Persisters/AbstractCollectionPersister.php @@ -65,11 +65,11 @@ abstract class AbstractCollectionPersister public function delete(PersistentCollection $coll) { $mapping = $coll->getMapping(); - + if ( ! $mapping['isOwningSide']) { return; // ignore inverse side } - + $sql = $this->_getDeleteSQL($coll); $this->_conn->executeUpdate($sql, $this->_getDeleteSQLParameters($coll)); } @@ -98,34 +98,34 @@ abstract class AbstractCollectionPersister public function update(PersistentCollection $coll) { $mapping = $coll->getMapping(); - + if ( ! $mapping['isOwningSide']) { return; // ignore inverse side } - + $this->deleteRows($coll); //$this->updateRows($coll); $this->insertRows($coll); } - + public function deleteRows(PersistentCollection $coll) - { + { $deleteDiff = $coll->getDeleteDiff(); $sql = $this->_getDeleteRowSQL($coll); - + foreach ($deleteDiff as $element) { $this->_conn->executeUpdate($sql, $this->_getDeleteRowSQLParameters($coll, $element)); } } - + //public function updateRows(PersistentCollection $coll) //{} - + public function insertRows(PersistentCollection $coll) { $insertDiff = $coll->getInsertDiff(); $sql = $this->_getInsertRowSQL($coll); - + foreach ($insertDiff as $element) { $this->_conn->executeUpdate($sql, $this->_getInsertRowSQLParameters($coll, $element)); } @@ -168,7 +168,7 @@ abstract class AbstractCollectionPersister /** * Gets the SQL statement used for deleting a row from the collection. - * + * * @param PersistentCollection $coll */ abstract protected function _getDeleteRowSQL(PersistentCollection $coll); diff --git a/lib/Doctrine/ORM/Persisters/AbstractEntityInheritancePersister.php b/lib/Doctrine/ORM/Persisters/AbstractEntityInheritancePersister.php index e3bb9a943..191c07798 100644 --- a/lib/Doctrine/ORM/Persisters/AbstractEntityInheritancePersister.php +++ b/lib/Doctrine/ORM/Persisters/AbstractEntityInheritancePersister.php @@ -26,7 +26,7 @@ use Doctrine\ORM\Mapping\ClassMetadata, * Base class for entity persisters that implement a certain inheritance mapping strategy. * All these persisters are assumed to use a discriminator column to discriminate entity * types in the hierarchy. - * + * * @author Roman Borschel * @author Benjamin Eberlei * @since 2.0 @@ -39,18 +39,18 @@ abstract class AbstractEntityInheritancePersister extends BasicEntityPersister protected function _prepareInsertData($entity) { $data = parent::_prepareInsertData($entity); - + // Populate the discriminator column $discColumn = $this->_class->discriminatorColumn; $this->_columnTypes[$discColumn['name']] = $discColumn['type']; $data[$this->_getDiscriminatorColumnTableName()][$discColumn['name']] = $this->_class->discriminatorValue; - + return $data; } /** * Gets the name of the table that contains the discriminator column. - * + * * @return string The table name. */ abstract protected function _getDiscriminatorColumnTableName(); @@ -77,7 +77,7 @@ abstract class AbstractEntityInheritancePersister extends BasicEntityPersister { $columnAlias = $this->getSQLColumnAlias($joinColumnName); $this->_rsm->addMetaResult('r', $columnAlias, $joinColumnName); - + return $tableAlias . '.' . $joinColumnName . ' AS ' . $columnAlias; } } diff --git a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php index 6845d984a..d2f1b4661 100644 --- a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php @@ -341,7 +341,7 @@ class BasicEntityPersister foreach ($updateData as $columnName => $value) { $column = $columnName; $placeholder = '?'; - + if (isset($this->_class->fieldNames[$columnName])) { $column = $this->_class->getQuotedColumnName($this->_class->fieldNames[$columnName], $this->_platform); @@ -1307,7 +1307,7 @@ class BasicEntityPersister foreach ($criteria as $field => $value) { $conditionSql .= $conditionSql ? ' AND ' : ''; - + $placeholder = '?'; if (isset($this->_class->columnNames[$field])) { diff --git a/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php b/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php index 2d9105709..34498a325 100644 --- a/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php +++ b/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php @@ -44,8 +44,8 @@ class ManyToManyPersister extends AbstractCollectionPersister { $mapping = $coll->getMapping(); $class = $this->_em->getClassMetadata(get_class($coll->getOwner())); - - return 'DELETE FROM ' . $class->getQuotedJoinTableName($mapping, $this->_conn->getDatabasePlatform()) + + return 'DELETE FROM ' . $class->getQuotedJoinTableName($mapping, $this->_conn->getDatabasePlatform()) . ' WHERE ' . implode(' = ? AND ', $mapping['joinTableColumns']) . ' = ?'; } @@ -81,9 +81,9 @@ class ManyToManyPersister extends AbstractCollectionPersister $mapping = $coll->getMapping(); $columns = $mapping['joinTableColumns']; $class = $this->_em->getClassMetadata(get_class($coll->getOwner())); - + $joinTable = $class->getQuotedJoinTableName($mapping, $this->_conn->getDatabasePlatform()); - + return 'INSERT INTO ' . $joinTable . ' (' . implode(', ', $columns) . ')' . ' VALUES (' . implode(', ', array_fill(0, count($columns), '?')) . ')'; } @@ -124,19 +124,19 @@ class ManyToManyPersister extends AbstractCollectionPersister foreach ($mapping['joinTableColumns'] as $joinTableColumn) { $isRelationToSource = isset($mapping['relationToSourceKeyColumns'][$joinTableColumn]); - + if ( ! $isComposite) { $params[] = $isRelationToSource ? array_pop($identifier1) : array_pop($identifier2); - + continue; } - + if ($isRelationToSource) { $params[] = $identifier1[$class1->getFieldForColumn($mapping['relationToSourceKeyColumns'][$joinTableColumn])]; - + continue; } - + $params[] = $identifier2[$class2->getFieldForColumn($mapping['relationToTargetKeyColumns'][$joinTableColumn])]; } @@ -152,8 +152,8 @@ class ManyToManyPersister extends AbstractCollectionPersister { $class = $this->_em->getClassMetadata(get_class($coll->getOwner())); $mapping = $coll->getMapping(); - - return 'DELETE FROM ' . $class->getQuotedJoinTableName($mapping, $this->_conn->getDatabasePlatform()) + + return 'DELETE FROM ' . $class->getQuotedJoinTableName($mapping, $this->_conn->getDatabasePlatform()) . ' WHERE ' . implode(' = ? AND ', array_keys($mapping['relationToSourceKeyColumns'])) . ' = ?'; } @@ -169,21 +169,21 @@ class ManyToManyPersister extends AbstractCollectionPersister $identifier = $this->_uow->getEntityIdentifier($coll->getOwner()); $mapping = $coll->getMapping(); $params = array(); - + // Optimization for single column identifier if (count($mapping['relationToSourceKeyColumns']) === 1) { $params[] = array_pop($identifier); - + return $params; } - + // Composite identifier $sourceClass = $this->_em->getClassMetadata(get_class($mapping->getOwner())); - + foreach ($mapping['relationToSourceKeyColumns'] as $relColumn => $srcColumn) { $params[] = $identifier[$sourceClass->fieldNames[$srcColumn]]; } - + return $params; } @@ -205,12 +205,12 @@ class ManyToManyPersister extends AbstractCollectionPersister $whereClauses = array(); $params = array(); - + foreach ($mapping['joinTableColumns'] as $joinTableColumn) { if ( ! isset($joinColumns[$joinTableColumn])) { continue; } - + $whereClauses[] = $joinTableColumn . ' = ?'; $params[] = ($class->containsForeignIdentifier) @@ -240,7 +240,7 @@ class ManyToManyPersister extends AbstractCollectionPersister public function slice(PersistentCollection $coll, $offset, $length = null) { $mapping = $coll->getMapping(); - + return $this->_em->getUnitOfWork()->getEntityPersister($mapping['targetEntity'])->getManyToManyCollection($mapping, $coll->getOwner(), $offset, $length); } @@ -259,12 +259,12 @@ class ManyToManyPersister extends AbstractCollectionPersister } list($quotedJoinTable, $whereClauses, $params) = $this->getJoinTableRestrictions($coll, $element, true); - + $sql = 'SELECT 1 FROM ' . $quotedJoinTable . ' WHERE ' . implode(' AND ', $whereClauses); return (bool) $this->_conn->fetchColumn($sql, $params); } - + /** * @param PersistentCollection $coll * @param object $element @@ -282,10 +282,10 @@ class ManyToManyPersister extends AbstractCollectionPersister list($quotedJoinTable, $whereClauses, $params) = $this->getJoinTableRestrictions($coll, $element, false); $sql = 'DELETE FROM ' . $quotedJoinTable . ' WHERE ' . implode(' AND ', $whereClauses); - + return (bool) $this->_conn->executeUpdate($sql, $params); } - + /** * @param \Doctrine\ORM\PersistentCollection $coll * @param object $element @@ -296,13 +296,13 @@ class ManyToManyPersister extends AbstractCollectionPersister { $uow = $this->_em->getUnitOfWork(); $mapping = $coll->getMapping(); - + if ( ! $mapping['isOwningSide']) { $sourceClass = $this->_em->getClassMetadata($mapping['targetEntity']); $targetClass = $this->_em->getClassMetadata($mapping['sourceEntity']); $sourceId = $uow->getEntityIdentifier($element); $targetId = $uow->getEntityIdentifier($coll->getOwner()); - + $mapping = $sourceClass->associationMappings[$mapping['mappedBy']]; } else { $sourceClass = $this->_em->getClassMetadata($mapping['sourceEntity']); @@ -310,11 +310,11 @@ class ManyToManyPersister extends AbstractCollectionPersister $sourceId = $uow->getEntityIdentifier($coll->getOwner()); $targetId = $uow->getEntityIdentifier($element); } - + $quotedJoinTable = $sourceClass->getQuotedJoinTableName($mapping, $this->_conn->getDatabasePlatform()); $whereClauses = array(); $params = array(); - + foreach ($mapping['joinTableColumns'] as $joinTableColumn) { $whereClauses[] = $joinTableColumn . ' = ?'; @@ -324,7 +324,7 @@ class ManyToManyPersister extends AbstractCollectionPersister : $targetId[$targetClass->fieldNames[$mapping['relationToTargetKeyColumns'][$joinTableColumn]]]; continue; } - + // relationToSourceKeyColumns $params[] = ($sourceClass->containsForeignIdentifier) ? $sourceId[$sourceClass->getFieldForColumn($mapping['relationToSourceKeyColumns'][$joinTableColumn])] @@ -338,7 +338,7 @@ class ManyToManyPersister extends AbstractCollectionPersister $whereClauses[] = $filterSql; } } - + return array($quotedJoinTable, $whereClauses, $params); } diff --git a/lib/Doctrine/ORM/Persisters/OneToManyPersister.php b/lib/Doctrine/ORM/Persisters/OneToManyPersister.php index b78d0e561..c4efd8c2e 100644 --- a/lib/Doctrine/ORM/Persisters/OneToManyPersister.php +++ b/lib/Doctrine/ORM/Persisters/OneToManyPersister.php @@ -44,14 +44,14 @@ class OneToManyPersister extends AbstractCollectionPersister { $mapping = $coll->getMapping(); $class = $this->_em->getClassMetadata($mapping['targetEntity']); - + return 'DELETE FROM ' . $class->getQuotedTableName($this->_conn->getDatabasePlatform()) . ' WHERE ' . implode('= ? AND ', $class->getIdentifierColumnNames()) . ' = ?'; } /** * {@inheritdoc} - * + * */ protected function _getDeleteRowSQLParameters(PersistentCollection $coll, $element) { @@ -110,10 +110,10 @@ class OneToManyPersister extends AbstractCollectionPersister $whereClauses = array(); $params = array(); - + foreach ($targetClass->associationMappings[$mapping['mappedBy']]['joinColumns'] AS $joinColumn) { $whereClauses[] = $joinColumn['name'] . ' = ?'; - + $params[] = ($targetClass->containsForeignIdentifier) ? $id[$sourceClass->getFieldForColumn($joinColumn['referencedColumnName'])] : $id[$sourceClass->fieldNames[$joinColumn['referencedColumnName']]]; @@ -143,7 +143,7 @@ class OneToManyPersister extends AbstractCollectionPersister $mapping = $coll->getMapping(); $uow = $this->_em->getUnitOfWork(); $persister = $uow->getEntityPersister($mapping['targetEntity']); - + return $persister->getOneToManyCollection($mapping, $coll->getOwner(), $offset, $length); } @@ -156,22 +156,22 @@ class OneToManyPersister extends AbstractCollectionPersister { $mapping = $coll->getMapping(); $uow = $this->_em->getUnitOfWork(); - + // shortcut for new entities if ($uow->getEntityState($element, UnitOfWork::STATE_NEW) == UnitOfWork::STATE_NEW) { return false; } $persister = $uow->getEntityPersister($mapping['targetEntity']); - - // only works with single id identifier entities. Will throw an - // exception in Entity Persisters if that is not the case for the + + // only works with single id identifier entities. Will throw an + // exception in Entity Persisters if that is not the case for the // 'mappedBy' field. $id = current( $uow->getEntityIdentifier($coll->getOwner()) ); return $persister->exists($element, array($mapping['mappedBy'] => $id)); } - + /** * @param PersistentCollection $coll * @param object $element @@ -190,7 +190,7 @@ class OneToManyPersister extends AbstractCollectionPersister $class = $this->_em->getClassMetadata($mapping['targetEntity']); $sql = 'DELETE FROM ' . $class->getQuotedTableName($this->_conn->getDatabasePlatform()) . ' WHERE ' . implode('= ? AND ', $class->getIdentifierColumnNames()) . ' = ?'; - + return (bool) $this->_conn->executeUpdate($sql, $this->_getDeleteRowSQLParameters($coll, $element)); } } diff --git a/lib/Doctrine/ORM/Persisters/SingleTablePersister.php b/lib/Doctrine/ORM/Persisters/SingleTablePersister.php index c2687c109..171264a1d 100644 --- a/lib/Doctrine/ORM/Persisters/SingleTablePersister.php +++ b/lib/Doctrine/ORM/Persisters/SingleTablePersister.php @@ -51,33 +51,33 @@ class SingleTablePersister extends AbstractEntityInheritancePersister // Append discriminator column $discrColumn = $this->_class->discriminatorColumn['name']; $columnList .= ', ' . $discrColumn; - + $rootClass = $this->_em->getClassMetadata($this->_class->rootEntityName); $tableAlias = $this->_getSQLTableAlias($rootClass->name); $resultColumnName = $this->_platform->getSQLResultCasing($discrColumn); - + $this->_rsm->setDiscriminatorColumn('r', $resultColumnName); $this->_rsm->addMetaResult('r', $resultColumnName, $discrColumn); // Append subclass columns foreach ($this->_class->subClasses as $subClassName) { $subClass = $this->_em->getClassMetadata($subClassName); - + // Regular columns foreach ($subClass->fieldMappings as $fieldName => $mapping) { if ( ! isset($mapping['inherited'])) { $columnList .= ', ' . $this->_getSelectColumnSQL($fieldName, $subClass); } } - + // Foreign key columns foreach ($subClass->associationMappings as $assoc) { if ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE && ! isset($assoc['inherited'])) { foreach ($assoc['targetToSourceKeyColumns'] as $srcColumn) { if ($columnList != '') $columnList .= ', '; - + $columnList .= $this->getSelectJoinColumnSQL( - $tableAlias, + $tableAlias, $srcColumn, isset($assoc['inherited']) ? $assoc['inherited'] : $this->_class->name ); @@ -94,7 +94,7 @@ class SingleTablePersister extends AbstractEntityInheritancePersister protected function _getInsertColumnList() { $columns = parent::_getInsertColumnList(); - + // Add discriminator column to the INSERT SQL $columns[] = $this->_class->discriminatorColumn['name']; @@ -114,19 +114,19 @@ class SingleTablePersister extends AbstractEntityInheritancePersister // Append discriminator condition if ($conditionSql) $conditionSql .= ' AND '; - + $values = array(); - + if ($this->_class->discriminatorValue !== null) { // discriminators can be 0 $values[] = $this->_conn->quote($this->_class->discriminatorValue); } $discrValues = array_flip($this->_class->discriminatorMap); - + foreach ($this->_class->subClasses as $subclassName) { $values[] = $this->_conn->quote($discrValues[$subclassName]); } - + $conditionSql .= $this->_getSQLTableAlias($this->_class->name) . '.' . $this->_class->discriminatorColumn['name'] . ' IN (' . implode(', ', $values) . ')'; diff --git a/lib/Doctrine/ORM/Persisters/UnionSubclassPersister.php b/lib/Doctrine/ORM/Persisters/UnionSubclassPersister.php index b2e683a27..ef844a706 100644 --- a/lib/Doctrine/ORM/Persisters/UnionSubclassPersister.php +++ b/lib/Doctrine/ORM/Persisters/UnionSubclassPersister.php @@ -4,5 +4,5 @@ namespace Doctrine\ORM\Persisters; class UnionSubclassPersister extends BasicEntityPersister { - + } \ No newline at end of file diff --git a/lib/Doctrine/ORM/Proxy/Proxy.php b/lib/Doctrine/ORM/Proxy/Proxy.php index 853f9c1f0..5eaff19fe 100644 --- a/lib/Doctrine/ORM/Proxy/Proxy.php +++ b/lib/Doctrine/ORM/Proxy/Proxy.php @@ -23,7 +23,7 @@ namespace Doctrine\ORM\Proxy; /** * Interface for proxy classes. - * + * * @author Roman Borschel * @since 2.0 */ diff --git a/lib/Doctrine/ORM/Query.php b/lib/Doctrine/ORM/Query.php index 252f9fa32..ff3f8426e 100644 --- a/lib/Doctrine/ORM/Query.php +++ b/lib/Doctrine/ORM/Query.php @@ -640,7 +640,7 @@ final class Query extends AbstractQuery public function __clone() { parent::__clone(); - + $this->_state = self::STATE_DIRTY; } } diff --git a/lib/Doctrine/ORM/Query/AST/ArithmeticFactor.php b/lib/Doctrine/ORM/Query/AST/ArithmeticFactor.php index b559e4a30..3ad6abf47 100644 --- a/lib/Doctrine/ORM/Query/AST/ArithmeticFactor.php +++ b/lib/Doctrine/ORM/Query/AST/ArithmeticFactor.php @@ -38,7 +38,7 @@ class ArithmeticFactor extends Node * @var ArithmeticPrimary */ public $arithmeticPrimary; - + /** * @var null|boolean NULL represents no sign, TRUE means positive and FALSE means negative sign */ diff --git a/lib/Doctrine/ORM/Query/AST/CoalesceExpression.php b/lib/Doctrine/ORM/Query/AST/CoalesceExpression.php index 338d49fce..dae074200 100644 --- a/lib/Doctrine/ORM/Query/AST/CoalesceExpression.php +++ b/lib/Doctrine/ORM/Query/AST/CoalesceExpression.php @@ -33,13 +33,13 @@ namespace Doctrine\ORM\Query\AST; class CoalesceExpression extends Node { public $scalarExpressions = array(); - + public function __construct(array $scalarExpressions) { $this->scalarExpressions = $scalarExpressions; - } - + } + public function dispatch($sqlWalker) { return $sqlWalker->walkCoalesceExpression($this); diff --git a/lib/Doctrine/ORM/Query/AST/CollectionMemberExpression.php b/lib/Doctrine/ORM/Query/AST/CollectionMemberExpression.php index ea252de08..62d756b88 100644 --- a/lib/Doctrine/ORM/Query/AST/CollectionMemberExpression.php +++ b/lib/Doctrine/ORM/Query/AST/CollectionMemberExpression.php @@ -18,7 +18,7 @@ * and is licensed under the LGPL. For more information, see * . */ - + namespace Doctrine\ORM\Query\AST; /** diff --git a/lib/Doctrine/ORM/Query/AST/DeleteStatement.php b/lib/Doctrine/ORM/Query/AST/DeleteStatement.php index de807abaa..01c6acbe1 100644 --- a/lib/Doctrine/ORM/Query/AST/DeleteStatement.php +++ b/lib/Doctrine/ORM/Query/AST/DeleteStatement.php @@ -41,7 +41,7 @@ class DeleteStatement extends Node { $this->deleteClause = $deleteClause; } - + public function dispatch($sqlWalker) { return $sqlWalker->walkDeleteStatement($this); diff --git a/lib/Doctrine/ORM/Query/AST/EmptyCollectionComparisonExpression.php b/lib/Doctrine/ORM/Query/AST/EmptyCollectionComparisonExpression.php index 271d304dc..6bb50e87d 100644 --- a/lib/Doctrine/ORM/Query/AST/EmptyCollectionComparisonExpression.php +++ b/lib/Doctrine/ORM/Query/AST/EmptyCollectionComparisonExpression.php @@ -18,7 +18,7 @@ * and is licensed under the LGPL. For more information, see * . */ - + namespace Doctrine\ORM\Query\AST; /** diff --git a/lib/Doctrine/ORM/Query/AST/FromClause.php b/lib/Doctrine/ORM/Query/AST/FromClause.php index 83aa85ccb..a4dc6282d 100644 --- a/lib/Doctrine/ORM/Query/AST/FromClause.php +++ b/lib/Doctrine/ORM/Query/AST/FromClause.php @@ -36,8 +36,8 @@ class FromClause extends Node public function __construct(array $identificationVariableDeclarations) { $this->identificationVariableDeclarations = $identificationVariableDeclarations; - } - + } + public function dispatch($sqlWalker) { return $sqlWalker->walkFromClause($this); diff --git a/lib/Doctrine/ORM/Query/AST/Functions/AbsFunction.php b/lib/Doctrine/ORM/Query/AST/Functions/AbsFunction.php index 3fafccd5b..3ee436035 100644 --- a/lib/Doctrine/ORM/Query/AST/Functions/AbsFunction.php +++ b/lib/Doctrine/ORM/Query/AST/Functions/AbsFunction.php @@ -53,9 +53,9 @@ class AbsFunction extends FunctionNode { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); - + $this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression(); - + $parser->match(Lexer::T_CLOSE_PARENTHESIS); } } diff --git a/lib/Doctrine/ORM/Query/AST/Functions/CurrentDateFunction.php b/lib/Doctrine/ORM/Query/AST/Functions/CurrentDateFunction.php index 7bf7683eb..66107cc00 100644 --- a/lib/Doctrine/ORM/Query/AST/Functions/CurrentDateFunction.php +++ b/lib/Doctrine/ORM/Query/AST/Functions/CurrentDateFunction.php @@ -16,7 +16,7 @@ * and is licensed under the LGPL. For more information, see * . */ - + namespace Doctrine\ORM\Query\AST\Functions; use Doctrine\ORM\Query\Lexer; diff --git a/lib/Doctrine/ORM/Query/AST/Functions/IdentityFunction.php b/lib/Doctrine/ORM/Query/AST/Functions/IdentityFunction.php index 10c7982c5..1b7592990 100644 --- a/lib/Doctrine/ORM/Query/AST/Functions/IdentityFunction.php +++ b/lib/Doctrine/ORM/Query/AST/Functions/IdentityFunction.php @@ -42,13 +42,13 @@ class IdentityFunction extends FunctionNode $platform = $sqlWalker->getConnection()->getDatabasePlatform(); $dqlAlias = $this->pathExpression->identificationVariable; $assocField = $this->pathExpression->field; - + $qComp = $sqlWalker->getQueryComponent($dqlAlias); $class = $qComp['metadata']; $assoc = $class->associationMappings[$assocField]; - + $tableAlias = $sqlWalker->getSQLTableAlias($class->getTableName(), $dqlAlias); - + return $tableAlias . '.' . reset($assoc['targetToSourceKeyColumns']);; } @@ -59,9 +59,9 @@ class IdentityFunction extends FunctionNode { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); - + $this->pathExpression = $parser->SingleValuedAssociationPathExpression(); - + $parser->match(Lexer::T_CLOSE_PARENTHESIS); } } diff --git a/lib/Doctrine/ORM/Query/AST/Functions/LengthFunction.php b/lib/Doctrine/ORM/Query/AST/Functions/LengthFunction.php index 36787786d..82dd4b49d 100644 --- a/lib/Doctrine/ORM/Query/AST/Functions/LengthFunction.php +++ b/lib/Doctrine/ORM/Query/AST/Functions/LengthFunction.php @@ -53,9 +53,9 @@ class LengthFunction extends FunctionNode { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); - + $this->stringPrimary = $parser->StringPrimary(); - + $parser->match(Lexer::T_CLOSE_PARENTHESIS); } } diff --git a/lib/Doctrine/ORM/Query/AST/Functions/LocateFunction.php b/lib/Doctrine/ORM/Query/AST/Functions/LocateFunction.php index a4ea71696..e630b2efe 100644 --- a/lib/Doctrine/ORM/Query/AST/Functions/LocateFunction.php +++ b/lib/Doctrine/ORM/Query/AST/Functions/LocateFunction.php @@ -61,20 +61,20 @@ class LocateFunction extends FunctionNode { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); - + $this->firstStringPrimary = $parser->StringPrimary(); - + $parser->match(Lexer::T_COMMA); - + $this->secondStringPrimary = $parser->StringPrimary(); - + $lexer = $parser->getLexer(); if ($lexer->isNextToken(Lexer::T_COMMA)) { $parser->match(Lexer::T_COMMA); - + $this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression(); } - + $parser->match(Lexer::T_CLOSE_PARENTHESIS); } } diff --git a/lib/Doctrine/ORM/Query/AST/Functions/LowerFunction.php b/lib/Doctrine/ORM/Query/AST/Functions/LowerFunction.php index 775f51d9a..7bc092dad 100644 --- a/lib/Doctrine/ORM/Query/AST/Functions/LowerFunction.php +++ b/lib/Doctrine/ORM/Query/AST/Functions/LowerFunction.php @@ -53,9 +53,9 @@ class LowerFunction extends FunctionNode { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); - + $this->stringPrimary = $parser->StringPrimary(); - + $parser->match(Lexer::T_CLOSE_PARENTHESIS); } } diff --git a/lib/Doctrine/ORM/Query/AST/Functions/ModFunction.php b/lib/Doctrine/ORM/Query/AST/Functions/ModFunction.php index 4d124fe85..53f064a90 100644 --- a/lib/Doctrine/ORM/Query/AST/Functions/ModFunction.php +++ b/lib/Doctrine/ORM/Query/AST/Functions/ModFunction.php @@ -55,13 +55,13 @@ class ModFunction extends FunctionNode { $parser->match(Lexer::T_MOD); $parser->match(Lexer::T_OPEN_PARENTHESIS); - + $this->firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression(); - + $parser->match(Lexer::T_COMMA); - + $this->secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression(); - + $parser->match(Lexer::T_CLOSE_PARENTHESIS); } } diff --git a/lib/Doctrine/ORM/Query/AST/Functions/SizeFunction.php b/lib/Doctrine/ORM/Query/AST/Functions/SizeFunction.php index 91e40395a..3decb918e 100644 --- a/lib/Doctrine/ORM/Query/AST/Functions/SizeFunction.php +++ b/lib/Doctrine/ORM/Query/AST/Functions/SizeFunction.php @@ -45,7 +45,7 @@ class SizeFunction extends FunctionNode $platform = $sqlWalker->getConnection()->getDatabasePlatform(); $dqlAlias = $this->collectionPathExpression->identificationVariable; $assocField = $this->collectionPathExpression->field; - + $qComp = $sqlWalker->getQueryComponent($dqlAlias); $class = $qComp['metadata']; $assoc = $class->associationMappings[$assocField]; @@ -61,7 +61,7 @@ class SizeFunction extends FunctionNode $owningAssoc = $targetClass->associationMappings[$assoc['mappedBy']]; $first = true; - + foreach ($owningAssoc['targetToSourceKeyColumns'] as $targetColumn => $sourceColumn) { if ($first) $first = false; else $sql .= ' AND '; @@ -100,7 +100,7 @@ class SizeFunction extends FunctionNode . $sourceTableAlias . '.' . $sourceColumnName; } } - + return '(' . $sql . ')'; } @@ -110,12 +110,12 @@ class SizeFunction extends FunctionNode public function parse(\Doctrine\ORM\Query\Parser $parser) { $lexer = $parser->getLexer(); - + $parser->match(Lexer::T_SIZE); $parser->match(Lexer::T_OPEN_PARENTHESIS); - + $this->collectionPathExpression = $parser->CollectionValuedPathExpression(); - + $parser->match(Lexer::T_CLOSE_PARENTHESIS); } } diff --git a/lib/Doctrine/ORM/Query/AST/Functions/SqrtFunction.php b/lib/Doctrine/ORM/Query/AST/Functions/SqrtFunction.php index 02ffa26a7..087b93be1 100644 --- a/lib/Doctrine/ORM/Query/AST/Functions/SqrtFunction.php +++ b/lib/Doctrine/ORM/Query/AST/Functions/SqrtFunction.php @@ -52,9 +52,9 @@ class SqrtFunction extends FunctionNode { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); - + $this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression(); - + $parser->match(Lexer::T_CLOSE_PARENTHESIS); } } diff --git a/lib/Doctrine/ORM/Query/AST/Functions/SubstringFunction.php b/lib/Doctrine/ORM/Query/AST/Functions/SubstringFunction.php index bfcbdefb3..c0e6223b2 100644 --- a/lib/Doctrine/ORM/Query/AST/Functions/SubstringFunction.php +++ b/lib/Doctrine/ORM/Query/AST/Functions/SubstringFunction.php @@ -64,15 +64,15 @@ class SubstringFunction extends FunctionNode $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->stringPrimary = $parser->StringPrimary(); - + $parser->match(Lexer::T_COMMA); - + $this->firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression(); $lexer = $parser->getLexer(); if ($lexer->isNextToken(Lexer::T_COMMA)) { $parser->match(Lexer::T_COMMA); - + $this->secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression(); } diff --git a/lib/Doctrine/ORM/Query/AST/Functions/UpperFunction.php b/lib/Doctrine/ORM/Query/AST/Functions/UpperFunction.php index acc8dd8eb..16a0ed816 100644 --- a/lib/Doctrine/ORM/Query/AST/Functions/UpperFunction.php +++ b/lib/Doctrine/ORM/Query/AST/Functions/UpperFunction.php @@ -53,9 +53,9 @@ class UpperFunction extends FunctionNode { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); - + $this->stringPrimary = $parser->StringPrimary(); - + $parser->match(Lexer::T_CLOSE_PARENTHESIS); } } diff --git a/lib/Doctrine/ORM/Query/AST/GeneralCaseExpression.php b/lib/Doctrine/ORM/Query/AST/GeneralCaseExpression.php index e9e49f070..facacd5fe 100644 --- a/lib/Doctrine/ORM/Query/AST/GeneralCaseExpression.php +++ b/lib/Doctrine/ORM/Query/AST/GeneralCaseExpression.php @@ -20,7 +20,7 @@ namespace Doctrine\ORM\Query\AST; /** - * GeneralCaseExpression ::= "CASE" WhenClause {WhenClause}* "ELSE" ScalarExpression "END" + * GeneralCaseExpression ::= "CASE" WhenClause {WhenClause}* "ELSE" ScalarExpression "END" * * @since 2.2 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL @@ -39,8 +39,8 @@ class GeneralCaseExpression extends Node { $this->whenClauses = $whenClauses; $this->elseScalarExpression = $elseScalarExpression; - } - + } + public function dispatch($sqlWalker) { return $sqlWalker->walkGeneralCaseExpression($this); diff --git a/lib/Doctrine/ORM/Query/AST/IdentificationVariableDeclaration.php b/lib/Doctrine/ORM/Query/AST/IdentificationVariableDeclaration.php index bf168c34b..2f590cc80 100644 --- a/lib/Doctrine/ORM/Query/AST/IdentificationVariableDeclaration.php +++ b/lib/Doctrine/ORM/Query/AST/IdentificationVariableDeclaration.php @@ -44,7 +44,7 @@ class IdentificationVariableDeclaration extends Node $this->indexBy = $indexBy; $this->joinVariableDeclarations = $joinVariableDecls; } - + public function dispatch($sqlWalker) { return $sqlWalker->walkIdentificationVariableDeclaration($this); diff --git a/lib/Doctrine/ORM/Query/AST/IndexBy.php b/lib/Doctrine/ORM/Query/AST/IndexBy.php index b657be70f..16f220630 100644 --- a/lib/Doctrine/ORM/Query/AST/IndexBy.php +++ b/lib/Doctrine/ORM/Query/AST/IndexBy.php @@ -39,8 +39,8 @@ class IndexBy extends Node public function __construct($simpleStateFieldPathExpression) { $this->simpleStateFieldPathExpression = $simpleStateFieldPathExpression; - } - + } + public function dispatch($sqlWalker) { return $sqlWalker->walkIndexBy($this); diff --git a/lib/Doctrine/ORM/Query/AST/InstanceOfExpression.php b/lib/Doctrine/ORM/Query/AST/InstanceOfExpression.php index b586f4812..4f254b578 100644 --- a/lib/Doctrine/ORM/Query/AST/InstanceOfExpression.php +++ b/lib/Doctrine/ORM/Query/AST/InstanceOfExpression.php @@ -36,7 +36,7 @@ class InstanceOfExpression extends Node public $not; public $identificationVariable; public $value; - + public function __construct($identVariable) { $this->identificationVariable = $identVariable; diff --git a/lib/Doctrine/ORM/Query/AST/Join.php b/lib/Doctrine/ORM/Query/AST/Join.php index 310a418a4..084f7d737 100644 --- a/lib/Doctrine/ORM/Query/AST/Join.php +++ b/lib/Doctrine/ORM/Query/AST/Join.php @@ -39,7 +39,7 @@ class Join extends Node const JOIN_TYPE_LEFTOUTER = 2; const JOIN_TYPE_INNER = 3; - public $joinType = self::JOIN_TYPE_INNER; + public $joinType = self::JOIN_TYPE_INNER; public $joinAssociationPathExpression = null; public $aliasIdentificationVariable = null; public $conditionalExpression = null; @@ -50,7 +50,7 @@ class Join extends Node $this->joinAssociationPathExpression = $joinAssocPathExpr; $this->aliasIdentificationVariable = $aliasIdentVar; } - + public function dispatch($sqlWalker) { return $sqlWalker->walkJoin($this); diff --git a/lib/Doctrine/ORM/Query/AST/JoinAssociationPathExpression.php b/lib/Doctrine/ORM/Query/AST/JoinAssociationPathExpression.php index 7f87e52f8..f9300b2ed 100644 --- a/lib/Doctrine/ORM/Query/AST/JoinAssociationPathExpression.php +++ b/lib/Doctrine/ORM/Query/AST/JoinAssociationPathExpression.php @@ -18,7 +18,7 @@ * and is licensed under the LGPL. For more information, see * . */ - + namespace Doctrine\ORM\Query\AST; /** diff --git a/lib/Doctrine/ORM/Query/AST/JoinVariableDeclaration.php b/lib/Doctrine/ORM/Query/AST/JoinVariableDeclaration.php index 687eba38d..7fa956222 100644 --- a/lib/Doctrine/ORM/Query/AST/JoinVariableDeclaration.php +++ b/lib/Doctrine/ORM/Query/AST/JoinVariableDeclaration.php @@ -42,7 +42,7 @@ class JoinVariableDeclaration extends Node $this->join = $join; $this->indexBy = $indexBy; } - + public function dispatch($sqlWalker) { return $sqlWalker->walkJoinVariableDeclaration($this); diff --git a/lib/Doctrine/ORM/Query/AST/Literal.php b/lib/Doctrine/ORM/Query/AST/Literal.php index d3acb9625..426907f6d 100644 --- a/lib/Doctrine/ORM/Query/AST/Literal.php +++ b/lib/Doctrine/ORM/Query/AST/Literal.php @@ -7,16 +7,16 @@ class Literal extends Node const STRING = 1; const BOOLEAN = 2; const NUMERIC = 3; - + public $type; public $value; - + public function __construct($type, $value) { $this->type = $type; $this->value = $value; } - + public function dispatch($walker) { return $walker->walkLiteral($this); diff --git a/lib/Doctrine/ORM/Query/AST/Node.php b/lib/Doctrine/ORM/Query/AST/Node.php index adaf06cae..8ef13c0b5 100644 --- a/lib/Doctrine/ORM/Query/AST/Node.php +++ b/lib/Doctrine/ORM/Query/AST/Node.php @@ -36,16 +36,16 @@ abstract class Node { /** * Double-dispatch method, supposed to dispatch back to the walker. - * + * * Implementation is not mandatory for all nodes. - * + * * @param $walker */ public function dispatch($walker) { throw ASTException::noDispatchForNode($this); } - + /** * Dumps the AST Node into a string representation for information purpose only * @@ -55,36 +55,36 @@ abstract class Node { return $this->dump($this); } - + public function dump($obj) { static $ident = 0; - + $str = ''; - + if ($obj instanceof Node) { $str .= get_class($obj) . '(' . PHP_EOL; $props = get_object_vars($obj); - + foreach ($props as $name => $prop) { $ident += 4; - $str .= str_repeat(' ', $ident) . '"' . $name . '": ' + $str .= str_repeat(' ', $ident) . '"' . $name . '": ' . $this->dump($prop) . ',' . PHP_EOL; $ident -= 4; } - + $str .= str_repeat(' ', $ident) . ')'; } else if (is_array($obj)) { $ident += 4; $str .= 'array('; $some = false; - + foreach ($obj as $k => $v) { - $str .= PHP_EOL . str_repeat(' ', $ident) . '"' + $str .= PHP_EOL . str_repeat(' ', $ident) . '"' . $k . '" => ' . $this->dump($v) . ','; $some = true; } - + $ident -= 4; $str .= ($some ? PHP_EOL . str_repeat(' ', $ident) : '') . ')'; } else if (is_object($obj)) { @@ -92,7 +92,7 @@ abstract class Node } else { $str .= var_export($obj, true); } - + return $str; } } \ No newline at end of file diff --git a/lib/Doctrine/ORM/Query/AST/NullComparisonExpression.php b/lib/Doctrine/ORM/Query/AST/NullComparisonExpression.php index aa205b712..0e64bd2fb 100644 --- a/lib/Doctrine/ORM/Query/AST/NullComparisonExpression.php +++ b/lib/Doctrine/ORM/Query/AST/NullComparisonExpression.php @@ -36,7 +36,7 @@ class NullComparisonExpression extends Node { public $not; public $expression; - + public function __construct($expression) { $this->expression = $expression; diff --git a/lib/Doctrine/ORM/Query/AST/NullIfExpression.php b/lib/Doctrine/ORM/Query/AST/NullIfExpression.php index c79d23a99..12c8c140f 100644 --- a/lib/Doctrine/ORM/Query/AST/NullIfExpression.php +++ b/lib/Doctrine/ORM/Query/AST/NullIfExpression.php @@ -33,15 +33,15 @@ namespace Doctrine\ORM\Query\AST; class NullIfExpression extends Node { public $firstExpression; - + public $secondExpression; public function __construct($firstExpression, $secondExpression) { $this->firstExpression = $firstExpression; $this->secondExpression = $secondExpression; - } - + } + public function dispatch($sqlWalker) { return $sqlWalker->walkNullIfExpression($this); diff --git a/lib/Doctrine/ORM/Query/AST/OrderByItem.php b/lib/Doctrine/ORM/Query/AST/OrderByItem.php index a05bac32b..207cbd369 100644 --- a/lib/Doctrine/ORM/Query/AST/OrderByItem.php +++ b/lib/Doctrine/ORM/Query/AST/OrderByItem.php @@ -36,7 +36,7 @@ class OrderByItem extends Node { public $expression; public $type; - + public function __construct($expression) { $this->expression = $expression; diff --git a/lib/Doctrine/ORM/Query/AST/PartialObjectExpression.php b/lib/Doctrine/ORM/Query/AST/PartialObjectExpression.php index 08fd564f2..d1757d790 100644 --- a/lib/Doctrine/ORM/Query/AST/PartialObjectExpression.php +++ b/lib/Doctrine/ORM/Query/AST/PartialObjectExpression.php @@ -6,7 +6,7 @@ class PartialObjectExpression extends Node { public $identificationVariable; public $partialFieldSet; - + public function __construct($identificationVariable, array $partialFieldSet) { $this->identificationVariable = $identificationVariable; diff --git a/lib/Doctrine/ORM/Query/AST/PathExpression.php b/lib/Doctrine/ORM/Query/AST/PathExpression.php index 45042c2ea..2f78b9c26 100644 --- a/lib/Doctrine/ORM/Query/AST/PathExpression.php +++ b/lib/Doctrine/ORM/Query/AST/PathExpression.php @@ -16,7 +16,7 @@ * and is licensed under the LGPL. For more information, see * . */ - + namespace Doctrine\ORM\Query\AST; /** @@ -27,7 +27,7 @@ namespace Doctrine\ORM\Query\AST; * CollectionValuedPathExpression ::= IdentificationVariable "." CollectionValuedAssociationField * StateField ::= {EmbeddedClassStateField "."}* SimpleStateField * SimpleStateFieldPathExpression ::= IdentificationVariable "." StateField - * + * * @since 2.0 * @author Guilherme Blanco * @author Jonathan Wage @@ -38,19 +38,19 @@ class PathExpression extends Node const TYPE_COLLECTION_VALUED_ASSOCIATION = 2; const TYPE_SINGLE_VALUED_ASSOCIATION = 4; const TYPE_STATE_FIELD = 8; - + public $type; public $expectedType; public $identificationVariable; public $field; - + public function __construct($expectedType, $identificationVariable, $field = null) { $this->expectedType = $expectedType; $this->identificationVariable = $identificationVariable; $this->field = $field; } - + public function dispatch($walker) { return $walker->walkPathExpression($this); diff --git a/lib/Doctrine/ORM/Query/AST/RangeVariableDeclaration.php b/lib/Doctrine/ORM/Query/AST/RangeVariableDeclaration.php index 7a01bdcbe..cf8b18020 100644 --- a/lib/Doctrine/ORM/Query/AST/RangeVariableDeclaration.php +++ b/lib/Doctrine/ORM/Query/AST/RangeVariableDeclaration.php @@ -41,8 +41,8 @@ class RangeVariableDeclaration extends Node { $this->abstractSchemaName = $abstractSchemaName; $this->aliasIdentificationVariable = $aliasIdentificationVar; - } - + } + public function dispatch($walker) { return $walker->walkRangeVariableDeclaration($this); diff --git a/lib/Doctrine/ORM/Query/AST/SelectClause.php b/lib/Doctrine/ORM/Query/AST/SelectClause.php index ed9fbaa34..cf8e9df30 100644 --- a/lib/Doctrine/ORM/Query/AST/SelectClause.php +++ b/lib/Doctrine/ORM/Query/AST/SelectClause.php @@ -42,7 +42,7 @@ class SelectClause extends Node $this->isDistinct = $isDistinct; $this->selectExpressions = $selectExpressions; } - + public function dispatch($sqlWalker) { return $sqlWalker->walkSelectClause($this); diff --git a/lib/Doctrine/ORM/Query/AST/SelectExpression.php b/lib/Doctrine/ORM/Query/AST/SelectExpression.php index e3c917200..fd0d49b28 100644 --- a/lib/Doctrine/ORM/Query/AST/SelectExpression.php +++ b/lib/Doctrine/ORM/Query/AST/SelectExpression.php @@ -44,8 +44,8 @@ class SelectExpression extends Node $this->expression = $expression; $this->fieldIdentificationVariable = $fieldIdentificationVariable; $this->hiddenAliasResultVariable = $hiddenAliasResultVariable; - } - + } + public function dispatch($sqlWalker) { return $sqlWalker->walkSelectExpression($this); diff --git a/lib/Doctrine/ORM/Query/AST/SelectStatement.php b/lib/Doctrine/ORM/Query/AST/SelectStatement.php index 01eed37d0..d65a97bef 100644 --- a/lib/Doctrine/ORM/Query/AST/SelectStatement.php +++ b/lib/Doctrine/ORM/Query/AST/SelectStatement.php @@ -44,8 +44,8 @@ class SelectStatement extends Node public function __construct($selectClause, $fromClause) { $this->selectClause = $selectClause; $this->fromClause = $fromClause; - } - + } + public function dispatch($sqlWalker) { return $sqlWalker->walkSelectStatement($this); diff --git a/lib/Doctrine/ORM/Query/AST/SimpleCaseExpression.php b/lib/Doctrine/ORM/Query/AST/SimpleCaseExpression.php index 9fd5e22ee..586928df3 100644 --- a/lib/Doctrine/ORM/Query/AST/SimpleCaseExpression.php +++ b/lib/Doctrine/ORM/Query/AST/SimpleCaseExpression.php @@ -20,7 +20,7 @@ namespace Doctrine\ORM\Query\AST; /** - * SimpleCaseExpression ::= "CASE" CaseOperand SimpleWhenClause {SimpleWhenClause}* "ELSE" ScalarExpression "END" + * SimpleCaseExpression ::= "CASE" CaseOperand SimpleWhenClause {SimpleWhenClause}* "ELSE" ScalarExpression "END" * * @since 2.2 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL @@ -41,8 +41,8 @@ class SimpleCaseExpression extends Node $this->caseOperand = $caseOperand; $this->simpleWhenClauses = $simpleWhenClauses; $this->elseScalarExpression = $elseScalarExpression; - } - + } + public function dispatch($sqlWalker) { return $sqlWalker->walkSimpleCaseExpression($this); diff --git a/lib/Doctrine/ORM/Query/AST/SimpleSelectClause.php b/lib/Doctrine/ORM/Query/AST/SimpleSelectClause.php index e3b93e7f6..8a4028036 100644 --- a/lib/Doctrine/ORM/Query/AST/SimpleSelectClause.php +++ b/lib/Doctrine/ORM/Query/AST/SimpleSelectClause.php @@ -42,7 +42,7 @@ class SimpleSelectClause extends Node $this->simpleSelectExpression = $simpleSelectExpression; $this->isDistinct = $isDistinct; } - + public function dispatch($sqlWalker) { return $sqlWalker->walkSimpleSelectClause($this); diff --git a/lib/Doctrine/ORM/Query/AST/SimpleSelectExpression.php b/lib/Doctrine/ORM/Query/AST/SimpleSelectExpression.php index e25d38bfc..1648c4dc5 100644 --- a/lib/Doctrine/ORM/Query/AST/SimpleSelectExpression.php +++ b/lib/Doctrine/ORM/Query/AST/SimpleSelectExpression.php @@ -41,8 +41,8 @@ class SimpleSelectExpression extends Node public function __construct($expression) { $this->expression = $expression; - } - + } + public function dispatch($sqlWalker) { return $sqlWalker->walkSimpleSelectExpression($this); diff --git a/lib/Doctrine/ORM/Query/AST/SimpleWhenClause.php b/lib/Doctrine/ORM/Query/AST/SimpleWhenClause.php index 1cb654f21..0345328a6 100644 --- a/lib/Doctrine/ORM/Query/AST/SimpleWhenClause.php +++ b/lib/Doctrine/ORM/Query/AST/SimpleWhenClause.php @@ -20,7 +20,7 @@ namespace Doctrine\ORM\Query\AST; /** - * SimpleWhenClause ::= "WHEN" ScalarExpression "THEN" ScalarExpression + * SimpleWhenClause ::= "WHEN" ScalarExpression "THEN" ScalarExpression * * @since 2.2 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL @@ -39,8 +39,8 @@ class SimpleWhenClause extends Node { $this->caseScalarExpression = $caseScalarExpression; $this->thenScalarExpression = $thenScalarExpression; - } - + } + public function dispatch($sqlWalker) { return $sqlWalker->walkWhenClauseExpression($this); diff --git a/lib/Doctrine/ORM/Query/AST/Subselect.php b/lib/Doctrine/ORM/Query/AST/Subselect.php index fa5d3356a..548e42ba7 100644 --- a/lib/Doctrine/ORM/Query/AST/Subselect.php +++ b/lib/Doctrine/ORM/Query/AST/Subselect.php @@ -45,8 +45,8 @@ class Subselect extends Node { $this->simpleSelectClause = $simpleSelectClause; $this->subselectFromClause = $subselectFromClause; - } - + } + public function dispatch($sqlWalker) { return $sqlWalker->walkSubselect($this); diff --git a/lib/Doctrine/ORM/Query/AST/SubselectFromClause.php b/lib/Doctrine/ORM/Query/AST/SubselectFromClause.php index 44d2b5988..c7c2f35f8 100644 --- a/lib/Doctrine/ORM/Query/AST/SubselectFromClause.php +++ b/lib/Doctrine/ORM/Query/AST/SubselectFromClause.php @@ -39,8 +39,8 @@ class SubselectFromClause extends Node public function __construct(array $identificationVariableDeclarations) { $this->identificationVariableDeclarations = $identificationVariableDeclarations; - } - + } + public function dispatch($sqlWalker) { return $sqlWalker->walkSubselectFromClause($this); diff --git a/lib/Doctrine/ORM/Query/AST/UpdateStatement.php b/lib/Doctrine/ORM/Query/AST/UpdateStatement.php index 7bf40bbc6..d1e152ea2 100644 --- a/lib/Doctrine/ORM/Query/AST/UpdateStatement.php +++ b/lib/Doctrine/ORM/Query/AST/UpdateStatement.php @@ -46,4 +46,4 @@ class UpdateStatement extends Node { return $sqlWalker->walkUpdateStatement($this); } -} \ No newline at end of file +} \ No newline at end of file diff --git a/lib/Doctrine/ORM/Query/AST/WhenClause.php b/lib/Doctrine/ORM/Query/AST/WhenClause.php index c20bad9f5..69556e5be 100644 --- a/lib/Doctrine/ORM/Query/AST/WhenClause.php +++ b/lib/Doctrine/ORM/Query/AST/WhenClause.php @@ -20,7 +20,7 @@ namespace Doctrine\ORM\Query\AST; /** - * WhenClause ::= "WHEN" ConditionalExpression "THEN" ScalarExpression + * WhenClause ::= "WHEN" ConditionalExpression "THEN" ScalarExpression * * @since 2.2 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL @@ -39,8 +39,8 @@ class WhenClause extends Node { $this->caseConditionExpression = $caseConditionExpression; $this->thenScalarExpression = $thenScalarExpression; - } - + } + public function dispatch($sqlWalker) { return $sqlWalker->walkWhenClauseExpression($this); diff --git a/lib/Doctrine/ORM/Query/Exec/MultiTableDeleteExecutor.php b/lib/Doctrine/ORM/Query/Exec/MultiTableDeleteExecutor.php index 5b07d4d02..51f4b8c5b 100644 --- a/lib/Doctrine/ORM/Query/Exec/MultiTableDeleteExecutor.php +++ b/lib/Doctrine/ORM/Query/Exec/MultiTableDeleteExecutor.php @@ -36,7 +36,7 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor private $_createTempTableSql; private $_dropTempTableSql; private $_insertSql; - + /** * Initializes a new MultiTableDeleteExecutor. * @@ -64,7 +64,7 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor $this->_insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ')' . ' SELECT t0.' . implode(', t0.', $idColumnNames); - + $rangeDecl = new AST\RangeVariableDeclaration($primaryClass->name, $primaryDqlAlias); $fromClause = new AST\FromClause(array(new AST\IdentificationVariableDeclaration($rangeDecl, null, array()))); $this->_insertSql .= $sqlWalker->walkFromClause($fromClause); @@ -84,7 +84,7 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor $this->_sqlStatements[] = 'DELETE FROM ' . $tableName . ' WHERE (' . $idColumnList . ') IN (' . $idSubselect . ')'; } - + // 4. Store DDL for temporary identifier table. $columnDefinitions = array(); foreach ($idColumnNames as $idColumnName) { diff --git a/lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php b/lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php index 67f0bfde8..8be24e555 100644 --- a/lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php +++ b/lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php @@ -80,7 +80,7 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor // 3. Create and store UPDATE statements $classNames = array_merge($primaryClass->parentClasses, array($primaryClass->name), $primaryClass->subClasses); $i = -1; - + foreach (array_reverse($classNames) as $className) { $affected = false; $class = $em->getClassMetadata($className); @@ -88,27 +88,27 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor foreach ($updateItems as $updateItem) { $field = $updateItem->pathExpression->field; - + if (isset($class->fieldMappings[$field]) && ! isset($class->fieldMappings[$field]['inherited']) || isset($class->associationMappings[$field]) && ! isset($class->associationMappings[$field]['inherited'])) { $newValue = $updateItem->newValue; - + if ( ! $affected) { $affected = true; ++$i; } else { $updateSql .= ', '; } - + $updateSql .= $sqlWalker->walkUpdateItem($updateItem); - + //FIXME: parameters can be more deeply nested. traverse the tree. //FIXME (URGENT): With query cache the parameter is out of date. Move to execute() stage. if ($newValue instanceof AST\InputParameter) { $paramKey = $newValue->name; $this->_sqlParameters[$i]['parameters'][] = $sqlWalker->getQuery()->getParameter($paramKey); $this->_sqlParameters[$i]['types'][] = $sqlWalker->getQuery()->getParameterType($paramKey); - + ++$this->_numParametersInUpdateClause; } } @@ -118,12 +118,12 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor $this->_sqlStatements[$i] = $updateSql . ' WHERE (' . $idColumnList . ') IN (' . $idSubselect . ')'; } } - + // Append WHERE clause to insertSql, if there is one. if ($AST->whereClause) { $this->_insertSql .= $sqlWalker->walkWhereClause($AST->whereClause); } - + // 4. Store DDL for temporary identifier table. $columnDefinitions = array(); @@ -133,10 +133,10 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor 'type' => Type::getType($rootClass->getTypeOfColumn($idColumnName)) ); } - + $this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' (' . $platform->getColumnDeclarationListSQL($columnDefinitions) . ')'; - + $this->_dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable); } @@ -152,8 +152,8 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor // Insert identifiers. Parameters from the update clause are cut off. $numUpdated = $conn->executeUpdate( - $this->_insertSql, - array_slice($params, $this->_numParametersInUpdateClause), + $this->_insertSql, + array_slice($params, $this->_numParametersInUpdateClause), array_slice($types, $this->_numParametersInUpdateClause) ); @@ -161,12 +161,12 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor for ($i=0, $count=count($this->_sqlStatements); $i<$count; ++$i) { $parameters = array(); $types = array(); - + if (isset($this->_sqlParameters[$i])) { $parameters = isset($this->_sqlParameters[$i]['parameters']) ? $this->_sqlParameters[$i]['parameters'] : array(); $types = isset($this->_sqlParameters[$i]['types']) ? $this->_sqlParameters[$i]['types'] : array(); } - + $conn->executeUpdate($this->_sqlStatements[$i], $parameters, $types); } diff --git a/lib/Doctrine/ORM/Query/Exec/SingleTableDeleteUpdateExecutor.php b/lib/Doctrine/ORM/Query/Exec/SingleTableDeleteUpdateExecutor.php index facccb715..467ce5460 100644 --- a/lib/Doctrine/ORM/Query/Exec/SingleTableDeleteUpdateExecutor.php +++ b/lib/Doctrine/ORM/Query/Exec/SingleTableDeleteUpdateExecutor.php @@ -30,7 +30,7 @@ use Doctrine\DBAL\Connection, * @author Roman Borschel * @link www.doctrine-project.org * @since 2.0 - * @todo This is exactly the same as SingleSelectExecutor. Unify in SingleStatementExecutor. + * @todo This is exactly the same as SingleSelectExecutor. Unify in SingleStatementExecutor. */ class SingleTableDeleteUpdateExecutor extends AbstractSqlExecutor { diff --git a/lib/Doctrine/ORM/Query/Expr/Comparison.php b/lib/Doctrine/ORM/Query/Expr/Comparison.php index 7fcd263a2..d42560eb7 100644 --- a/lib/Doctrine/ORM/Query/Expr/Comparison.php +++ b/lib/Doctrine/ORM/Query/Expr/Comparison.php @@ -40,7 +40,7 @@ class Comparison const LTE = '<='; const GT = '>'; const GTE = '>='; - + private $_leftExpr; private $_operator; private $_rightExpr; diff --git a/lib/Doctrine/ORM/Query/Expr/From.php b/lib/Doctrine/ORM/Query/Expr/From.php index 4c0c8175a..e5707cce6 100644 --- a/lib/Doctrine/ORM/Query/Expr/From.php +++ b/lib/Doctrine/ORM/Query/Expr/From.php @@ -38,17 +38,17 @@ class From * @var string */ private $_from; - + /** - * @var string + * @var string */ private $_alias; - + /** - * @var string + * @var string */ private $_indexBy; - + /** * @param string $from The class name. * @param string $alias The alias of the class. @@ -60,7 +60,7 @@ class From $this->_alias = $alias; $this->_indexBy = $indexBy; } - + /** * @return string */ @@ -82,7 +82,7 @@ class From */ public function __toString() { - return $this->_from . ' ' . $this->_alias . + return $this->_from . ' ' . $this->_alias . ($this->_indexBy ? ' INDEX BY ' . $this->_indexBy : ''); } } \ No newline at end of file diff --git a/lib/Doctrine/ORM/Query/Expr/Join.php b/lib/Doctrine/ORM/Query/Expr/Join.php index 54ad6ead7..14f5b43cd 100644 --- a/lib/Doctrine/ORM/Query/Expr/Join.php +++ b/lib/Doctrine/ORM/Query/Expr/Join.php @@ -36,10 +36,10 @@ class Join { const INNER_JOIN = 'INNER'; const LEFT_JOIN = 'LEFT'; - + const ON = 'ON'; const WITH = 'WITH'; - + private $_joinType; private $_join; private $_alias; diff --git a/lib/Doctrine/ORM/Query/Expr/Math.php b/lib/Doctrine/ORM/Query/Expr/Math.php index c6135c866..e7e8b329c 100644 --- a/lib/Doctrine/ORM/Query/Expr/Math.php +++ b/lib/Doctrine/ORM/Query/Expr/Math.php @@ -49,18 +49,18 @@ class Math { // Adjusting Left Expression $leftExpr = (string) $this->_leftExpr; - + if ($this->_leftExpr instanceof Math) { $leftExpr = '(' . $leftExpr . ')'; } - + // Adjusting Right Expression $rightExpr = (string) $this->_rightExpr; - + if ($this->_rightExpr instanceof Math) { $rightExpr = '(' . $rightExpr . ')'; } - + return $leftExpr . ' ' . $this->_operator . ' ' . $rightExpr; } } \ No newline at end of file diff --git a/lib/Doctrine/ORM/Query/ParameterTypeInferer.php b/lib/Doctrine/ORM/Query/ParameterTypeInferer.php index 8664f8670..39aef2974 100644 --- a/lib/Doctrine/ORM/Query/ParameterTypeInferer.php +++ b/lib/Doctrine/ORM/Query/ParameterTypeInferer.php @@ -39,9 +39,9 @@ class ParameterTypeInferer * Infer type of a given value, returning a compatible constant: * - Type (\Doctrine\DBAL\Types\Type::*) * - Connection (\Doctrine\DBAL\Connection::PARAM_*) - * + * * @param mixed $value Parameter value - * + * * @return mixed Parameter type constant */ public static function inferType($value) diff --git a/lib/Doctrine/ORM/Query/ParserResult.php b/lib/Doctrine/ORM/Query/ParserResult.php index 42aecc184..3e938a9c3 100644 --- a/lib/Doctrine/ORM/Query/ParserResult.php +++ b/lib/Doctrine/ORM/Query/ParserResult.php @@ -37,14 +37,14 @@ class ParserResult { /** * The SQL executor used for executing the SQL. - * + * * @var \Doctrine\ORM\Query\Exec\AbstractSqlExecutor */ private $_sqlExecutor; /** * The ResultSetMapping that describes how to map the SQL result set. - * + * * @var \Doctrine\ORM\Query\ResultSetMapping */ private $_resultSetMapping; @@ -55,7 +55,7 @@ class ParserResult * @var array */ private $_parameterMappings = array(); - + /** * Initializes a new instance of the ParserResult class. * The new instance is initialized with an empty ResultSetMapping. @@ -67,7 +67,7 @@ class ParserResult /** * Gets the ResultSetMapping for the parsed query. - * + * * @return ResultSetMapping The result set mapping of the parsed query or NULL * if the query is not a SELECT query. */ @@ -88,7 +88,7 @@ class ParserResult /** * Sets the SQL executor that should be used for this ParserResult. - * + * * @param \Doctrine\ORM\Query\Exec\AbstractSqlExecutor $executor */ public function setSqlExecutor($executor) @@ -98,14 +98,14 @@ class ParserResult /** * Gets the SQL executor used by this ParserResult. - * + * * @return \Doctrine\ORM\Query\Exec\AbstractSqlExecutor */ public function getSqlExecutor() { return $this->_sqlExecutor; } - + /** * Adds a DQL to SQL parameter mapping. One DQL parameter name/position can map to * several SQL parameter positions. @@ -117,17 +117,17 @@ class ParserResult { $this->_parameterMappings[$dqlPosition][] = $sqlPosition; } - + /** * Gets all DQL to SQL parameter mappings. - * + * * @return array The parameter mappings. */ public function getParameterMappings() { return $this->_parameterMappings; } - + /** * Gets the SQL parameter positions for a DQL parameter name/position. * diff --git a/lib/Doctrine/ORM/Query/ResultSetMapping.php b/lib/Doctrine/ORM/Query/ResultSetMapping.php index 3c292fda4..b35af474f 100644 --- a/lib/Doctrine/ORM/Query/ResultSetMapping.php +++ b/lib/Doctrine/ORM/Query/ResultSetMapping.php @@ -131,7 +131,7 @@ class ResultSetMapping if ($resultAlias !== null) { $this->isMixed = true; } - + return $this; } @@ -150,7 +150,7 @@ class ResultSetMapping { $this->discriminatorColumns[$alias] = $discrColumn; $this->columnOwnerMap[$discrColumn] = $alias; - + return $this; } @@ -185,7 +185,7 @@ class ResultSetMapping throw new \LogicException($message); } */ - + return $this; } @@ -198,7 +198,7 @@ class ResultSetMapping public function addIndexByScalar($resultColumnName) { $this->indexByMap['scalars'] = $resultColumnName; - + return $this; } @@ -212,7 +212,7 @@ class ResultSetMapping public function addIndexByColumn($alias, $resultColumnName) { $this->indexByMap[$alias] = $resultColumnName; - + return $this; } @@ -268,7 +268,7 @@ class ResultSetMapping if ( ! $this->isMixed && $this->scalarMappings) { $this->isMixed = true; } - + return $this; } @@ -287,7 +287,7 @@ class ResultSetMapping $this->aliasMap[$alias] = $class; $this->parentAliasMap[$alias] = $parentAlias; $this->relationMap[$alias] = $relation; - + return $this; } @@ -306,7 +306,7 @@ class ResultSetMapping if ( ! $this->isMixed && $this->fieldMappings) { $this->isMixed = true; } - + return $this; } @@ -469,7 +469,7 @@ class ResultSetMapping if ($isIdentifierColumn) { $this->isIdentifierColumn[$alias][$columnName] = true; } - + return $this; } } diff --git a/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/MetadataCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/MetadataCommand.php index 13243a0f7..afff8db63 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/MetadataCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/MetadataCommand.php @@ -51,11 +51,11 @@ class MetadataCommand extends Console\Command\Command 'If defined, cache entries will be flushed instead of deleted/invalidated.' ) )); - + $fullName = $this->getName(); $this->setHelp(<<$fullName command is meant to clear the metadata cache of associated Entity Manager. -It is possible to invalidate all cache entries at once - called delete -, or flushes the cache provider +It is possible to invalidate all cache entries at once - called delete -, or flushes the cache provider instance completely. The execution type differ on how you execute the command. @@ -66,7 +66,7 @@ If you want to invalidate the entries (and not delete from cache instance), this Alternatively, if you want to flush the cache provider using this command: $fullName --flush - + Finally, be aware that if --flush option is passed, not all cache providers are able to flush entries, because of a limitation of its execution nature. EOT @@ -84,7 +84,7 @@ EOT if ( ! $cacheDriver) { throw new \InvalidArgumentException('No Metadata cache driver is configured on given EntityManager.'); } - + if ($cacheDriver instanceof Cache\ApcCache) { throw new \LogicException("Cannot clear APC Cache from Console, its shared in the Webserver memory and not accessible from the CLI."); } @@ -93,12 +93,12 @@ EOT $result = $cacheDriver->deleteAll(); $message = ($result) ? 'Successfully deleted cache entries.' : 'No cache entries were deleted.'; - + if (true === $input->getOption('flush')) { $result = $cacheDriver->flushAll(); $message = ($result) ? 'Successfully flushed cache entries.' : $message; } - + $output->write($message . PHP_EOL); } } diff --git a/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/QueryCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/QueryCommand.php index 6451d4ad7..6ad75cdcb 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/QueryCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/QueryCommand.php @@ -51,11 +51,11 @@ class QueryCommand extends Console\Command\Command 'If defined, cache entries will be flushed instead of deleted/invalidated.' ) )); - + $fullName = $this->getName(); $this->setHelp(<<$fullName command is meant to clear the query cache of associated Entity Manager. -It is possible to invalidate all cache entries at once - called delete -, or flushes the cache provider +It is possible to invalidate all cache entries at once - called delete -, or flushes the cache provider instance completely. The execution type differ on how you execute the command. @@ -66,7 +66,7 @@ If you want to invalidate the entries (and not delete from cache instance), this Alternatively, if you want to flush the cache provider using this command: $fullName --flush - + Finally, be aware that if --flush option is passed, not all cache providers are able to flush entries, because of a limitation of its execution nature. EOT @@ -84,7 +84,7 @@ EOT if ( ! $cacheDriver) { throw new \InvalidArgumentException('No Query cache driver is configured on given EntityManager.'); } - + if ($cacheDriver instanceof Cache\ApcCache) { throw new \LogicException("Cannot clear APC Cache from Console, its shared in the Webserver memory and not accessible from the CLI."); } @@ -93,12 +93,12 @@ EOT $result = $cacheDriver->deleteAll(); $message = ($result) ? 'Successfully deleted cache entries.' : 'No cache entries were deleted.'; - + if (true === $input->getOption('flush')) { $result = $cacheDriver->flushAll(); $message = ($result) ? 'Successfully flushed cache entries.' : $message; } - + $output->write($message . PHP_EOL); } } diff --git a/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/ResultCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/ResultCommand.php index 1dfacb056..5bb000c72 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/ResultCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/ResultCommand.php @@ -51,11 +51,11 @@ class ResultCommand extends Console\Command\Command 'If defined, cache entries will be flushed instead of deleted/invalidated.' ) )); - + $fullName = $this->getName(); $this->setHelp(<<$fullName command is meant to clear the result cache of associated Entity Manager. -It is possible to invalidate all cache entries at once - called delete -, or flushes the cache provider +It is possible to invalidate all cache entries at once - called delete -, or flushes the cache provider instance completely. The execution type differ on how you execute the command. @@ -66,7 +66,7 @@ If you want to invalidate the entries (and not delete from cache instance), this Alternatively, if you want to flush the cache provider using this command: $fullName --flush - + Finally, be aware that if --flush option is passed, not all cache providers are able to flush entries, because of a limitation of its execution nature. EOT @@ -84,7 +84,7 @@ EOT if ( ! $cacheDriver) { throw new \InvalidArgumentException('No Result cache driver is configured on given EntityManager.'); } - + if ($cacheDriver instanceof Cache\ApcCache) { throw new \LogicException("Cannot clear APC Cache from Console, its shared in the Webserver memory and not accessible from the CLI."); } @@ -93,12 +93,12 @@ EOT $result = $cacheDriver->deleteAll(); $message = ($result) ? 'Successfully deleted cache entries.' : 'No cache entries were deleted.'; - + if (true === $input->getOption('flush')) { $result = $cacheDriver->flushAll(); $message = ($result) ? 'Successfully flushed cache entries.' : $message; } - + $output->write($message . PHP_EOL); } } \ No newline at end of file diff --git a/lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php index 1a1328aac..c78920bcc 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php @@ -80,7 +80,7 @@ class ConvertDoctrine1SchemaCommand extends Console\Command\Command if ($this->metadataExporter == null) { $this->metadataExporter = new ClassMetadataExporter(); } - + return $this->metadataExporter; } @@ -91,7 +91,7 @@ class ConvertDoctrine1SchemaCommand extends Console\Command\Command { $this->metadataExporter = $metadataExporter; } - + /** * @see Console\Command\Command */ diff --git a/lib/Doctrine/ORM/Tools/Console/Command/GenerateEntitiesCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/GenerateEntitiesCommand.php index 0c65712cb..f00e6d2c4 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/GenerateEntitiesCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/GenerateEntitiesCommand.php @@ -112,12 +112,12 @@ EOT protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output) { $em = $this->getHelper('em')->getEntityManager(); - + $cmf = new DisconnectedClassMetadataFactory(); $cmf->setEntityManager($em); $metadatas = $cmf->getAllMetadata(); $metadatas = MetadataFilter::filter($metadatas, $input->getOption('filter')); - + // Process destination directory $destPath = realpath($input->getArgument('dest-path')); diff --git a/lib/Doctrine/ORM/Tools/Console/Command/GenerateProxiesCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/GenerateProxiesCommand.php index cd7578b27..7028d99e2 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/GenerateProxiesCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/GenerateProxiesCommand.php @@ -70,7 +70,7 @@ EOT protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output) { $em = $this->getHelper('em')->getEntityManager(); - + $metadatas = $em->getMetadataFactory()->getAllMetadata(); $metadatas = MetadataFilter::filter($metadatas, $input->getOption('filter')); diff --git a/lib/Doctrine/ORM/Tools/Console/Command/GenerateRepositoriesCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/GenerateRepositoriesCommand.php index 2a92493e8..bb6fc9d8b 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/GenerateRepositoriesCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/GenerateRepositoriesCommand.php @@ -70,7 +70,7 @@ EOT protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output) { $em = $this->getHelper('em')->getEntityManager(); - + $metadatas = $em->getMetadataFactory()->getAllMetadata(); $metadatas = MetadataFilter::filter($metadatas, $input->getOption('filter')); diff --git a/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/UpdateCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/UpdateCommand.php index a39995e0f..2b0fc0dd0 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/UpdateCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/UpdateCommand.php @@ -127,7 +127,7 @@ EOT $output->writeln(sprintf('The Schema-Tool would execute "%s" queries to update the database.', count($sqls))); $output->writeln('Please run the operation by passing one of the following options:'); - + $output->writeln(sprintf(' %s --force to execute the command', $this->getName())); $output->writeln(sprintf(' %s --dump-sql to dump the SQL statements to the screen', $this->getName())); } diff --git a/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php b/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php index 2fd6ed35b..6907dde39 100644 --- a/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php +++ b/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php @@ -26,7 +26,7 @@ class ConsoleRunner { /** * Run console with the given helperset. - * + * * @param \Symfony\Component\Console\Helper\HelperSet $helperSet * @return void */ diff --git a/lib/Doctrine/ORM/Tools/Console/MetadataFilter.php b/lib/Doctrine/ORM/Tools/Console/MetadataFilter.php index efd720802..2f69d89c5 100644 --- a/lib/Doctrine/ORM/Tools/Console/MetadataFilter.php +++ b/lib/Doctrine/ORM/Tools/Console/MetadataFilter.php @@ -37,7 +37,7 @@ class MetadataFilter extends \FilterIterator implements \Countable { /** * Filter Metadatas by one or more filter options. - * + * * @param array $metadatas * @param array|string $filter * @return array diff --git a/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php b/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php index 8b69ce067..93edebbdc 100644 --- a/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php +++ b/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php @@ -101,7 +101,7 @@ class ConvertDoctrine1Schema { if (isset($model['tableName']) && $model['tableName']) { $e = explode('.', $model['tableName']); - + if (count($e) > 1) { $metadata->table['schema'] = $e[0]; $metadata->table['name'] = $e[1]; diff --git a/lib/Doctrine/ORM/Tools/DebugUnitOfWorkListener.php b/lib/Doctrine/ORM/Tools/DebugUnitOfWorkListener.php index 5475d998f..0548b9644 100644 --- a/lib/Doctrine/ORM/Tools/DebugUnitOfWorkListener.php +++ b/lib/Doctrine/ORM/Tools/DebugUnitOfWorkListener.php @@ -54,7 +54,7 @@ class DebugUnitOfWorkListener /** * Dump the contents of the identity map into a stream. - * + * * @param EntityManager $em * @return void */ diff --git a/lib/Doctrine/ORM/Tools/DisconnectedClassMetadataFactory.php b/lib/Doctrine/ORM/Tools/DisconnectedClassMetadataFactory.php index 7a7715231..f98c8bfae 100644 --- a/lib/Doctrine/ORM/Tools/DisconnectedClassMetadataFactory.php +++ b/lib/Doctrine/ORM/Tools/DisconnectedClassMetadataFactory.php @@ -24,7 +24,7 @@ use Doctrine\ORM\Mapping\ClassMetadataInfo; /** * The DisconnectedClassMetadataFactory is used to create ClassMetadataInfo objects - * that do not require the entity class actually exist. This allows us to + * that do not require the entity class actually exist. This allows us to * load some mapping information and use it to do things like generate code * from the mapping information. * diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/AbstractExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/AbstractExporter.php index 75302717e..14f654130 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/AbstractExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/AbstractExporter.php @@ -56,7 +56,7 @@ abstract class AbstractExporter * Converts a single ClassMetadata instance to the exported format * and returns it * - * @param ClassMetadataInfo $metadata + * @param ClassMetadataInfo $metadata * @return mixed $exported */ abstract public function exportClassMetadata(ClassMetadataInfo $metadata); @@ -64,7 +64,7 @@ abstract class AbstractExporter /** * Set the array of ClassMetadataInfo instances to export * - * @param array $metadata + * @param array $metadata * @return void */ public function setMetadata(array $metadata) @@ -90,7 +90,7 @@ abstract class AbstractExporter * $exporter->setOutputDir(__DIR__ . '/yaml'); * $exporter->export(); * - * @param string $dir + * @param string $dir * @return void */ public function setOutputDir($dir) @@ -127,7 +127,7 @@ abstract class AbstractExporter /** * Generate the path to write the class for the given ClassMetadataInfo instance * - * @param ClassMetadataInfo $metadata + * @param ClassMetadataInfo $metadata * @return string $path */ protected function _generateOutputPath(ClassMetadataInfo $metadata) @@ -162,11 +162,11 @@ abstract class AbstractExporter case ClassMetadataInfo::INHERITANCE_TYPE_JOINED: return 'JOINED'; break; - + case ClassMetadataInfo::INHERITANCE_TYPE_SINGLE_TABLE: return 'SINGLE_TABLE'; break; - + case ClassMetadataInfo::INHERITANCE_TYPE_TABLE_PER_CLASS: return 'PER_CLASS'; break; @@ -180,11 +180,11 @@ abstract class AbstractExporter case ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT: return 'DEFERRED_IMPLICIT'; break; - + case ClassMetadataInfo::CHANGETRACKING_DEFERRED_EXPLICIT: return 'DEFERRED_EXPLICIT'; break; - + case ClassMetadataInfo::CHANGETRACKING_NOTIFY: return 'NOTIFY'; break; @@ -198,15 +198,15 @@ abstract class AbstractExporter case ClassMetadataInfo::GENERATOR_TYPE_AUTO: return 'AUTO'; break; - + case ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE: return 'SEQUENCE'; break; - + case ClassMetadataInfo::GENERATOR_TYPE_TABLE: return 'TABLE'; break; - + case ClassMetadataInfo::GENERATOR_TYPE_IDENTITY: return 'IDENTITY'; break; diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php index 254905eec..5053290d8 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php @@ -44,7 +44,7 @@ class AnnotationExporter extends AbstractExporter * Converts a single ClassMetadata instance to the exported format * and returns it * - * @param ClassMetadataInfo $metadata + * @param ClassMetadataInfo $metadata * @return string $exported */ public function exportClassMetadata(ClassMetadataInfo $metadata) diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php index 900fb5bda..fc561c908 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php @@ -41,7 +41,7 @@ class PhpExporter extends AbstractExporter * Converts a single ClassMetadata instance to the exported format * and returns it * - * @param ClassMetadataInfo $metadata + * @param ClassMetadataInfo $metadata * @return mixed $exported */ public function exportClassMetadata(ClassMetadataInfo $metadata) @@ -108,7 +108,7 @@ class PhpExporter extends AbstractExporter 'targetEntity' => $associationMapping['targetEntity'], 'cascade' => $cascade, ); - + if ($associationMapping['type'] & ClassMetadataInfo::TO_ONE) { $method = 'mapOneToOne'; $oneToOneMappingArray = array( @@ -117,10 +117,10 @@ class PhpExporter extends AbstractExporter 'joinColumns' => $associationMapping['joinColumns'], 'orphanRemoval' => $associationMapping['orphanRemoval'], ); - + $associationMappingArray = array_merge($associationMappingArray, $oneToOneMappingArray); } else if ($associationMapping['type'] == ClassMetadataInfo::ONE_TO_MANY) { - $method = 'mapOneToMany'; + $method = 'mapOneToMany'; $potentialAssociationMappingIndexes = array( 'mappedBy', 'orphanRemoval', @@ -133,7 +133,7 @@ class PhpExporter extends AbstractExporter } $associationMappingArray = array_merge($associationMappingArray, $oneToManyMappingArray); } else if ($associationMapping['type'] == ClassMetadataInfo::MANY_TO_MANY) { - $method = 'mapManyToMany'; + $method = 'mapManyToMany'; $potentialAssociationMappingIndexes = array( 'mappedBy', 'joinTable', @@ -146,7 +146,7 @@ class PhpExporter extends AbstractExporter } $associationMappingArray = array_merge($associationMappingArray, $manyToManyMappingArray); } - + $lines[] = '$metadata->' . $method . '(' . $this->_varExport($associationMappingArray) . ');'; } diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php index 869580613..bda29810f 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php @@ -41,7 +41,7 @@ class XmlExporter extends AbstractExporter * Converts a single ClassMetadata instance to the exported format * and returns it * - * @param ClassMetadataInfo $metadata + * @param ClassMetadataInfo $metadata * @return mixed $exported */ public function exportClassMetadata(ClassMetadataInfo $metadata) @@ -99,7 +99,7 @@ class XmlExporter extends AbstractExporter if (isset($metadata->table['indexes'])) { $indexesXml = $root->addChild('indexes'); - + foreach ($metadata->table['indexes'] as $name => $index) { $indexXml = $indexesXml->addChild('index'); $indexXml->addAttribute('name', $name); @@ -109,7 +109,7 @@ class XmlExporter extends AbstractExporter if (isset($metadata->table['uniqueConstraints'])) { $uniqueConstraintsXml = $root->addChild('unique-constraints'); - + foreach ($metadata->table['uniqueConstraints'] as $unique) { $uniqueConstraintXml = $uniqueConstraintsXml->addChild('unique-constraint'); $uniqueConstraintXml->addAttribute('name', $unique['name']); @@ -118,7 +118,7 @@ class XmlExporter extends AbstractExporter } $fields = $metadata->fieldMappings; - + $id = array(); foreach ($fields as $name => $field) { if (isset($field['id']) && $field['id']) { diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php index de76c7bdd..2d16792b1 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php @@ -49,13 +49,13 @@ class YamlExporter extends AbstractExporter public function exportClassMetadata(ClassMetadataInfo $metadata) { $array = array(); - + if ($metadata->isMappedSuperclass) { $array['type'] = 'mappedSuperclass'; } else { $array['type'] = 'entity'; } - + $array['table'] = $metadata->table['name']; if (isset($metadata->table['schema'])) { diff --git a/lib/Doctrine/ORM/Tools/Setup.php b/lib/Doctrine/ORM/Tools/Setup.php index b4a6a2c7f..c2550e2c7 100644 --- a/lib/Doctrine/ORM/Tools/Setup.php +++ b/lib/Doctrine/ORM/Tools/Setup.php @@ -28,7 +28,7 @@ use Doctrine\ORM\Mapping\Driver\YamlDriver; /** * Convenience class for setting up Doctrine from different installations and configurations. - * + * * @author Benjamin Eberlei */ class Setup @@ -36,8 +36,8 @@ class Setup /** * Use this method to register all autoloaders for a setup where Doctrine is checked out from * its github repository at {@link http://github.com/doctrine/doctrine2} - * - * @param string $gitCheckoutRootPath + * + * @param string $gitCheckoutRootPath * @return void */ static public function registerAutoloadGit($gitCheckoutRootPath) @@ -45,24 +45,24 @@ class Setup if (!class_exists('Doctrine\Common\ClassLoader', false)) { require_once $gitCheckoutRootPath . "/lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php"; } - + $loader = new ClassLoader("Doctrine\Common", $gitCheckoutRootPath . "/lib/vendor/doctrine-common/lib"); $loader->register(); - + $loader = new ClassLoader("Doctrine\DBAL", $gitCheckoutRootPath . "/lib/vendor/doctrine-dbal/lib"); $loader->register(); - + $loader = new ClassLoader("Doctrine\ORM", $gitCheckoutRootPath . "/lib"); $loader->register(); - + $loader = new ClassLoader("Symfony\Component", $gitCheckoutRootPath . "/lib/vendor"); $loader->register(); } - + /** * Use this method to register all autoloaders for a setup where Doctrine is installed * though {@link http://pear.doctrine-project.org}. - * + * * @return void */ static public function registerAutoloadPEAR() @@ -70,12 +70,12 @@ class Setup if (!class_exists('Doctrine\Common\ClassLoader', false)) { require_once "Doctrine/Common/ClassLoader.php"; } - + $loader = new ClassLoader("Doctrine"); $loader->register(); - + $parts = explode(PATH_SEPARATOR, get_include_path()); - + foreach ($parts AS $includePath) { if ($includePath != "." && file_exists($includePath . "/Doctrine")) { $loader = new ClassLoader("Symfony\Component", $includePath . "/Doctrine"); @@ -84,29 +84,29 @@ class Setup } } } - + /** * Use this method to register all autoloads for a downloaded Doctrine library. * Pick the directory the library was uncompressed into. - * - * @param string $directory + * + * @param string $directory */ static public function registerAutoloadDirectory($directory) { if (!class_exists('Doctrine\Common\ClassLoader', false)) { require_once $directory . "/Doctrine/Common/ClassLoader.php"; } - + $loader = new ClassLoader("Doctrine", $directory); $loader->register(); - + $loader = new ClassLoader("Symfony\Component", $directory . "/Doctrine"); $loader->register(); } - + /** * Create a configuration with an annotation metadata driver. - * + * * @param array $paths * @param boolean $isDevMode * @param string $proxyDir @@ -119,10 +119,10 @@ class Setup $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver($paths)); return $config; } - + /** * Create a configuration with a xml metadata driver. - * + * * @param array $paths * @param boolean $isDevMode * @param string $proxyDir @@ -135,10 +135,10 @@ class Setup $config->setMetadataDriverImpl(new XmlDriver($paths)); return $config; } - + /** * Create a configuration with a yaml metadata driver. - * + * * @param array $paths * @param boolean $isDevMode * @param string $proxyDir @@ -151,14 +151,14 @@ class Setup $config->setMetadataDriverImpl(new YamlDriver($paths)); return $config; } - + /** * Create a configuration without a metadata driver. - * + * * @param bool $isDevMode * @param string $proxyDir * @param Cache $cache - * @return Configuration + * @return Configuration */ static public function createConfiguration($isDevMode = false, $proxyDir = null, Cache $cache = null) { @@ -180,7 +180,7 @@ class Setup $cache = new ArrayCache; } $cache->setNamespace("dc2_" . md5($proxyDir) . "_"); // to avoid collisions - + $config = new Configuration(); $config->setMetadataCacheImpl($cache); $config->setQueryCacheImpl($cache); @@ -188,7 +188,7 @@ class Setup $config->setProxyDir( $proxyDir ); $config->setProxyNamespace('DoctrineProxies'); $config->setAutoGenerateProxyClasses($isDevMode); - + return $config; } } \ No newline at end of file diff --git a/lib/Doctrine/ORM/Version.php b/lib/Doctrine/ORM/Version.php index 183887147..e8124cd45 100644 --- a/lib/Doctrine/ORM/Version.php +++ b/lib/Doctrine/ORM/Version.php @@ -16,7 +16,7 @@ * and is licensed under the LGPL. For more information, see * . */ - + namespace Doctrine\ORM; /** @@ -42,7 +42,7 @@ class Version * Compares a Doctrine version with the current one. * * @param string $version Doctrine version to compare. - * @return int Returns -1 if older, 0 if it is the same, 1 if version + * @return int Returns -1 if older, 0 if it is the same, 1 if version * passed as argument is newer. */ public static function compare($version) diff --git a/tests/Doctrine/Tests/Mocks/ClassMetadataMock.php b/tests/Doctrine/Tests/Mocks/ClassMetadataMock.php index 39c53646d..c6be1b79c 100644 --- a/tests/Doctrine/Tests/Mocks/ClassMetadataMock.php +++ b/tests/Doctrine/Tests/Mocks/ClassMetadataMock.php @@ -5,10 +5,10 @@ namespace Doctrine\Tests\Mocks; class ClassMetadataMock extends \Doctrine\ORM\Mapping\ClassMetadata { /* Mock API */ - + public function setIdGeneratorType($type) { $this->_generatorType = $type; } - + } \ No newline at end of file diff --git a/tests/Doctrine/Tests/Mocks/DriverMock.php b/tests/Doctrine/Tests/Mocks/DriverMock.php index 2c7fadc52..c60a137f5 100644 --- a/tests/Doctrine/Tests/Mocks/DriverMock.php +++ b/tests/Doctrine/Tests/Mocks/DriverMock.php @@ -13,7 +13,7 @@ class DriverMock implements \Doctrine\DBAL\Driver { return new DriverConnectionMock(); } - + /** * Constructs the Sqlite PDO DSN. * diff --git a/tests/Doctrine/Tests/Mocks/EntityManagerMock.php b/tests/Doctrine/Tests/Mocks/EntityManagerMock.php index edf220a42..04b038d85 100644 --- a/tests/Doctrine/Tests/Mocks/EntityManagerMock.php +++ b/tests/Doctrine/Tests/Mocks/EntityManagerMock.php @@ -39,7 +39,7 @@ class EntityManagerMock extends \Doctrine\ORM\EntityManager { return isset($this->_uowMock) ? $this->_uowMock : parent::getUnitOfWork(); } - + /* Mock API */ /** @@ -61,7 +61,7 @@ class EntityManagerMock extends \Doctrine\ORM\EntityManager { return isset($this->_proxyFactoryMock) ? $this->_proxyFactoryMock : parent::getProxyFactory(); } - + /** * Mock factory method to create an EntityManager. * @@ -83,8 +83,8 @@ class EntityManagerMock extends \Doctrine\ORM\EntityManager if (is_null($eventManager)) { $eventManager = new \Doctrine\Common\EventManager(); } - - return new EntityManagerMock($conn, $config, $eventManager); + + return new EntityManagerMock($conn, $config, $eventManager); } /* public function setIdGenerator($className, $generator) @@ -99,7 +99,7 @@ class EntityManagerMock extends \Doctrine\ORM\EntityManager if (isset($this->_idGenerators[$className])) { return $this->_idGenerators[$className]; } - + return parent::getIdGenerator($className); } */ diff --git a/tests/Doctrine/Tests/Mocks/EntityPersisterMock.php b/tests/Doctrine/Tests/Mocks/EntityPersisterMock.php index 157c96e78..768e357b1 100644 --- a/tests/Doctrine/Tests/Mocks/EntityPersisterMock.php +++ b/tests/Doctrine/Tests/Mocks/EntityPersisterMock.php @@ -53,7 +53,7 @@ class EntityPersisterMock extends \Doctrine\ORM\Persisters\BasicEntityPersister { $this->_mockIdGeneratorType = $genType; } - + public function update($entity) { $this->_updates[] = $entity; @@ -63,27 +63,27 @@ class EntityPersisterMock extends \Doctrine\ORM\Persisters\BasicEntityPersister { $this->existsCalled = true; } - + public function delete($entity) { $this->_deletes[] = $entity; } - + public function getInserts() { return $this->_inserts; } - + public function getUpdates() { return $this->_updates; } - + public function getDeletes() { return $this->_deletes; } - + public function reset() { $this->existsCalled = false; diff --git a/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php b/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php index b5f5e3b47..83e978f06 100644 --- a/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php +++ b/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php @@ -106,6 +106,6 @@ class HydratorMockStatement implements \IteratorAggregate, \Doctrine\DBAL\Driver public function setFetchMode($fetchMode) { - + } } \ No newline at end of file diff --git a/tests/Doctrine/Tests/Mocks/MockTreeWalker.php b/tests/Doctrine/Tests/Mocks/MockTreeWalker.php index 809b11443..b92b99f43 100644 --- a/tests/Doctrine/Tests/Mocks/MockTreeWalker.php +++ b/tests/Doctrine/Tests/Mocks/MockTreeWalker.php @@ -6,7 +6,7 @@ class MockTreeWalker extends \Doctrine\ORM\Query\TreeWalkerAdapter { /** * Gets an executor that can be used to execute the result of this walker. - * + * * @return AbstractExecutor */ public function getExecutor($AST) diff --git a/tests/Doctrine/Tests/Mocks/SchemaManagerMock.php b/tests/Doctrine/Tests/Mocks/SchemaManagerMock.php index d78376e79..d4c3c28c0 100644 --- a/tests/Doctrine/Tests/Mocks/SchemaManagerMock.php +++ b/tests/Doctrine/Tests/Mocks/SchemaManagerMock.php @@ -8,6 +8,6 @@ class SchemaManagerMock extends \Doctrine\DBAL\Schema\AbstractSchemaManager { parent::__construct($conn); } - + protected function _getPortableTableColumnDefinition($tableColumn) {} } \ No newline at end of file diff --git a/tests/Doctrine/Tests/Models/CMS/CmsArticle.php b/tests/Doctrine/Tests/Models/CMS/CmsArticle.php index 5cc516735..266cbc662 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsArticle.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsArticle.php @@ -36,7 +36,7 @@ class CmsArticle * @Version @column(type="integer") */ public $version; - + public function setAuthor(CmsUser $author) { $this->user = $author; } diff --git a/tests/Doctrine/Tests/Models/CMS/CmsEmail.php b/tests/Doctrine/Tests/Models/CMS/CmsEmail.php index 2d8818cbd..c79c30036 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsEmail.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsEmail.php @@ -29,7 +29,7 @@ class CmsEmail public function getId() { return $this->id; } - + public function getEmail() { return $this->email; } @@ -37,7 +37,7 @@ class CmsEmail public function setEmail($email) { $this->email = $email; } - + public function getUser() { return $this->user; } diff --git a/tests/Doctrine/Tests/Models/CMS/CmsGroup.php b/tests/Doctrine/Tests/Models/CMS/CmsGroup.php index ad399ba18..b65ae8557 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsGroup.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsGroup.php @@ -1,5 +1,5 @@ user = $user; } - + public function getUser() { return $this->user; } diff --git a/tests/Doctrine/Tests/Models/CMS/CmsUser.php b/tests/Doctrine/Tests/Models/CMS/CmsUser.php index 3296fffc8..05fefb590 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsUser.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsUser.php @@ -55,7 +55,7 @@ class CmsUser * ) */ public $groups; - + public function __construct() { $this->phonenumbers = new ArrayCollection; $this->articles = new ArrayCollection; @@ -115,22 +115,22 @@ class CmsUser } return false; } - + public function getAddress() { return $this->address; } - + public function setAddress(CmsAddress $address) { if ($this->address !== $address) { $this->address = $address; $address->setUser($this); } } - + public function getEmail() { return $this->email; } - + public function setEmail(CmsEmail $email = null) { if ($this->email !== $email) { $this->email = $email; - + if ($email) { $email->setUser($this); } diff --git a/tests/Doctrine/Tests/Models/Company/CompanyAuction.php b/tests/Doctrine/Tests/Models/Company/CompanyAuction.php index 88b56e2f6..5dc72e8c1 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyAuction.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyAuction.php @@ -6,11 +6,11 @@ namespace Doctrine\Tests\Models\Company; class CompanyAuction extends CompanyEvent { /** @Column(type="string") */ private $data; - + public function setData($data) { $this->data = $data; } - + public function getData() { return $this->data; } diff --git a/tests/Doctrine/Tests/Models/Company/CompanyCar.php b/tests/Doctrine/Tests/Models/Company/CompanyCar.php index f970c273d..5af89b2a3 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyCar.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyCar.php @@ -13,7 +13,7 @@ class CompanyCar * @GeneratedValue(strategy="AUTO") */ private $id; - + /** * @Column(type="string", length=50) */ @@ -22,11 +22,11 @@ class CompanyCar public function __construct($brand = null) { $this->brand = $brand; } - + public function getId() { return $this->id; } - + public function getBrand() { return $this->title; } diff --git a/tests/Doctrine/Tests/Models/Company/CompanyContract.php b/tests/Doctrine/Tests/Models/Company/CompanyContract.php index 655d4fccb..221bf1cd8 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyContract.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyContract.php @@ -8,8 +8,8 @@ namespace Doctrine\Tests\Models\Company; * @InheritanceType("SINGLE_TABLE") * @DiscriminatorColumn(name="discr", type="string") * @DiscriminatorMap({ - * "fix" = "CompanyFixContract", - * "flexible" = "CompanyFlexContract", + * "fix" = "CompanyFixContract", + * "flexible" = "CompanyFlexContract", * "flexultra" = "CompanyFlexUltraContract" * }) */ diff --git a/tests/Doctrine/Tests/Models/Company/CompanyEmployee.php b/tests/Doctrine/Tests/Models/Company/CompanyEmployee.php index 61be7c5e6..5e050f948 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyEmployee.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyEmployee.php @@ -17,7 +17,7 @@ class CompanyEmployee extends CompanyPerson * @Column(type="string", length=255) */ private $department; - + /** * @Column(type="datetime", nullable=true) */ diff --git a/tests/Doctrine/Tests/Models/Company/CompanyEvent.php b/tests/Doctrine/Tests/Models/Company/CompanyEvent.php index 2db4986ae..bb320aa91 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyEvent.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyEvent.php @@ -20,17 +20,17 @@ abstract class CompanyEvent { * @JoinColumn(name="org_id", referencedColumnName="id") */ private $organization; - + public function getId() { return $this->id; } - + public function getOrganization() { return $this->organization; } - + public function setOrganization(CompanyOrganization $org) { $this->organization = $org; } - + } \ No newline at end of file diff --git a/tests/Doctrine/Tests/Models/Company/CompanyManager.php b/tests/Doctrine/Tests/Models/Company/CompanyManager.php index 226995185..e0d39dfcf 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyManager.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyManager.php @@ -12,7 +12,7 @@ class CompanyManager extends CompanyEmployee * @Column(type="string", length=250) */ private $title; - + /** * @OneToOne(targetEntity="CompanyCar", cascade={"persist"}) * @JoinColumn(name="car_id", referencedColumnName="id") @@ -26,11 +26,11 @@ class CompanyManager extends CompanyEmployee public function setTitle($title) { $this->title = $title; } - + public function getCar() { return $this->car; } - + public function setCar(CompanyCar $car) { $this->car = $car; } diff --git a/tests/Doctrine/Tests/Models/Company/CompanyOrganization.php b/tests/Doctrine/Tests/Models/Company/CompanyOrganization.php index ce47e8d9e..19463206b 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyOrganization.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyOrganization.php @@ -9,35 +9,35 @@ class CompanyOrganization { * @GeneratedValue(strategy="AUTO") */ private $id; - + /** * @OneToMany(targetEntity="CompanyEvent", mappedBy="organization", cascade={"persist"}) */ private $events; - + public function getId() { return $this->id; } - + public function getEvents() { return $this->events; } - + public function addEvent(CompanyEvent $event) { $this->events[] = $event; $event->setOrganization($this); } - + /** * @OneToOne(targetEntity="CompanyEvent", cascade={"persist"}) * @JoinColumn(name="main_event_id", referencedColumnName="id", nullable=true) */ private $mainevent; - + public function getMainEvent() { return $this->mainevent; } - + public function setMainEvent($event) { $this->mainevent = $event; } diff --git a/tests/Doctrine/Tests/Models/Company/CompanyPerson.php b/tests/Doctrine/Tests/Models/Company/CompanyPerson.php index 740c323ef..712e81c83 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyPerson.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyPerson.php @@ -32,7 +32,7 @@ class CompanyPerson * @JoinColumn(name="spouse_id", referencedColumnName="id") */ private $spouse; - + /** * @ManyToMany(targetEntity="CompanyPerson") * @JoinTable(name="company_persons_friends", @@ -40,7 +40,7 @@ class CompanyPerson inverseJoinColumns={@JoinColumn(name="friend_id", referencedColumnName="id")}) */ private $friends; - + public function __construct() { $this->friends = new \Doctrine\Common\Collections\ArrayCollection; } @@ -60,11 +60,11 @@ class CompanyPerson public function getSpouse() { return $this->spouse; } - + public function getFriends() { return $this->friends; } - + public function addFriend(CompanyPerson $friend) { if ( ! $this->friends->contains($friend)) { $this->friends->add($friend); diff --git a/tests/Doctrine/Tests/Models/Company/CompanyRaffle.php b/tests/Doctrine/Tests/Models/Company/CompanyRaffle.php index 3d05996f2..733190d58 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyRaffle.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyRaffle.php @@ -6,11 +6,11 @@ namespace Doctrine\Tests\Models\Company; class CompanyRaffle extends CompanyEvent { /** @Column */ private $data; - + public function setData($data) { $this->data = $data; } - + public function getData() { return $this->data; } diff --git a/tests/Doctrine/Tests/Models/DDC117/DDC117Article.php b/tests/Doctrine/Tests/Models/DDC117/DDC117Article.php index 70b1c6353..d77bb942b 100644 --- a/tests/Doctrine/Tests/Models/DDC117/DDC117Article.php +++ b/tests/Doctrine/Tests/Models/DDC117/DDC117Article.php @@ -9,7 +9,7 @@ class DDC117Article { /** @Id @Column(type="integer", name="article_id") @GeneratedValue */ private $id; - + /** @Column */ private $title; diff --git a/tests/Doctrine/Tests/Models/DDC1476/DDC1476EntityWithDefaultFieldType.php b/tests/Doctrine/Tests/Models/DDC1476/DDC1476EntityWithDefaultFieldType.php index f06199b4d..cc09c13e9 100644 --- a/tests/Doctrine/Tests/Models/DDC1476/DDC1476EntityWithDefaultFieldType.php +++ b/tests/Doctrine/Tests/Models/DDC1476/DDC1476EntityWithDefaultFieldType.php @@ -27,8 +27,8 @@ class DDC1476EntityWithDefaultFieldType { /** - * @Id - * @Column() + * @Id + * @Column() * @GeneratedValue("NONE") */ protected $id; @@ -37,7 +37,7 @@ class DDC1476EntityWithDefaultFieldType protected $name; /** - * @return integer + * @return integer */ public function getId() { @@ -45,7 +45,7 @@ class DDC1476EntityWithDefaultFieldType } /** - * @return string + * @return string */ public function getName() { @@ -53,13 +53,13 @@ class DDC1476EntityWithDefaultFieldType } /** - * @param string $name + * @param string $name */ public function setName($name) { $this->name = $name; } - + public static function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata) { $metadata->mapField(array( @@ -69,7 +69,7 @@ class DDC1476EntityWithDefaultFieldType $metadata->mapField(array( 'fieldName' => 'name', )); - + $metadata->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadataInfo::GENERATOR_TYPE_NONE); } diff --git a/tests/Doctrine/Tests/Models/DDC753/DDC753CustomRepository.php b/tests/Doctrine/Tests/Models/DDC753/DDC753CustomRepository.php index d277cf8aa..eaf9006c7 100644 --- a/tests/Doctrine/Tests/Models/DDC753/DDC753CustomRepository.php +++ b/tests/Doctrine/Tests/Models/DDC753/DDC753CustomRepository.php @@ -26,7 +26,7 @@ class DDC753CustomRepository extends EntityRepository { /** - * @return bool + * @return bool */ public function isCustomRepository() { diff --git a/tests/Doctrine/Tests/Models/DDC753/DDC753DefaultRepository.php b/tests/Doctrine/Tests/Models/DDC753/DDC753DefaultRepository.php index feba2cb50..5be9aa522 100644 --- a/tests/Doctrine/Tests/Models/DDC753/DDC753DefaultRepository.php +++ b/tests/Doctrine/Tests/Models/DDC753/DDC753DefaultRepository.php @@ -25,7 +25,7 @@ use Doctrine\ORM\EntityRepository; class DDC753DefaultRepository extends EntityRepository { /** - * @return bool + * @return bool */ public function isDefaultRepository() { diff --git a/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithCustomRepository.php b/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithCustomRepository.php index fa8a77957..7b92e66ac 100644 --- a/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithCustomRepository.php +++ b/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithCustomRepository.php @@ -27,8 +27,8 @@ class DDC753EntityWithCustomRepository { /** - * @Id - * @Column(type="integer") + * @Id + * @Column(type="integer") * @GeneratedValue */ protected $id; diff --git a/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithDefaultCustomRepository.php b/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithDefaultCustomRepository.php index 43f435a98..8ca2a2c94 100644 --- a/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithDefaultCustomRepository.php +++ b/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithDefaultCustomRepository.php @@ -27,8 +27,8 @@ class DDC753EntityWithDefaultCustomRepository { /** - * @Id - * @Column(type="integer") + * @Id + * @Column(type="integer") * @GeneratedValue */ protected $id; diff --git a/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithInvalidRepository.php b/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithInvalidRepository.php index e7c21762a..d12660cf4 100644 --- a/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithInvalidRepository.php +++ b/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithInvalidRepository.php @@ -27,8 +27,8 @@ class DDC753EntityWithInvalidRepository { /** - * @Id - * @Column(type="integer") + * @Id + * @Column(type="integer") * @GeneratedValue */ protected $id; diff --git a/tests/Doctrine/Tests/Models/DDC869/DDC869ChequePayment.php b/tests/Doctrine/Tests/Models/DDC869/DDC869ChequePayment.php index 46cceb4c7..594f79f78 100644 --- a/tests/Doctrine/Tests/Models/DDC869/DDC869ChequePayment.php +++ b/tests/Doctrine/Tests/Models/DDC869/DDC869ChequePayment.php @@ -28,7 +28,7 @@ class DDC869ChequePayment extends DDC869Payment /** @column(type="string") */ protected $serialNumber; - + public static function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata) { $metadata->mapField(array( diff --git a/tests/Doctrine/Tests/Models/DDC869/DDC869CreditCardPayment.php b/tests/Doctrine/Tests/Models/DDC869/DDC869CreditCardPayment.php index b446e059a..9e978d494 100644 --- a/tests/Doctrine/Tests/Models/DDC869/DDC869CreditCardPayment.php +++ b/tests/Doctrine/Tests/Models/DDC869/DDC869CreditCardPayment.php @@ -28,7 +28,7 @@ class DDC869CreditCardPayment extends DDC869Payment /** @column(type="string") */ protected $creditCardNumber; - + public static function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata) { $metadata->mapField(array( diff --git a/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php b/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php index c3c365715..b9b8febdc 100644 --- a/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php +++ b/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php @@ -27,16 +27,16 @@ class DDC869Payment { /** - * @Id - * @Column(type="integer") + * @Id + * @Column(type="integer") * @GeneratedValue */ protected $id; /** @column(type="float") */ protected $value; - - + + public static function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata) { $metadata->mapField(array( diff --git a/tests/Doctrine/Tests/Models/DDC869/DDC869PaymentRepository.php b/tests/Doctrine/Tests/Models/DDC869/DDC869PaymentRepository.php index d9018266a..f950df0e0 100644 --- a/tests/Doctrine/Tests/Models/DDC869/DDC869PaymentRepository.php +++ b/tests/Doctrine/Tests/Models/DDC869/DDC869PaymentRepository.php @@ -27,8 +27,8 @@ class DDC869PaymentRepository extends EntityRepository /** * Very complex method - * - * @return bool + * + * @return bool */ public function isTrue() { diff --git a/tests/Doctrine/Tests/Models/DirectoryTree/AbstractContentItem.php b/tests/Doctrine/Tests/Models/DirectoryTree/AbstractContentItem.php index 200a88ab1..12b27eed3 100644 --- a/tests/Doctrine/Tests/Models/DirectoryTree/AbstractContentItem.php +++ b/tests/Doctrine/Tests/Models/DirectoryTree/AbstractContentItem.php @@ -28,7 +28,7 @@ abstract class AbstractContentItem * @Id @Column(type="integer") @GeneratedValue */ private $id; - + /** * @ManyToOne(targetEntity="Directory") */ diff --git a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCart.php b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCart.php index d68b37056..3d9f6798f 100644 --- a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCart.php +++ b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCart.php @@ -44,26 +44,26 @@ class ECommerceCart { $this->products = new ArrayCollection; } - + public function getId() { return $this->id; } - + public function getPayment() { return $this->payment; } - + public function setPayment($payment) { $this->payment = $payment; } - + public function setCustomer(ECommerceCustomer $customer) { if ($this->customer !== $customer) { $this->customer = $customer; $customer->setCart($this); } } - + public function removeCustomer() { if ($this->customer !== null) { $customer = $this->customer; @@ -71,7 +71,7 @@ class ECommerceCart $customer->removeCart(); } } - + public function getCustomer() { return $this->customer; } diff --git a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php index 0144b0998..a5de9e119 100644 --- a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php +++ b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php @@ -33,20 +33,20 @@ class ECommerceCustomer * Example of a one-one self referential association. A mentor can follow * only one customer at the time, while a customer can choose only one * mentor. Not properly appropriate but it works. - * + * * @OneToOne(targetEntity="ECommerceCustomer", cascade={"persist"}, fetch="EAGER") * @JoinColumn(name="mentor_id", referencedColumnName="id") */ private $mentor; - + public function getId() { return $this->id; } - + public function getName() { return $this->name; } - + public function setName($name) { $this->name = $name; } @@ -55,15 +55,15 @@ class ECommerceCustomer { if ($this->cart !== $cart) { $this->cart = $cart; - $cart->setCustomer($this); + $cart->setCustomer($this); } } - + /* Does not properly maintain the bidirectional association! */ public function brokenSetCart(ECommerceCart $cart) { $this->cart = $cart; } - + public function getCart() { return $this->cart; } diff --git a/tests/Doctrine/Tests/Models/ECommerce/ECommerceFeature.php b/tests/Doctrine/Tests/Models/ECommerce/ECommerceFeature.php index 8f6cdd983..04fc2bed3 100644 --- a/tests/Doctrine/Tests/Models/ECommerce/ECommerceFeature.php +++ b/tests/Doctrine/Tests/Models/ECommerce/ECommerceFeature.php @@ -32,19 +32,19 @@ class ECommerceFeature public function getId() { return $this->id; } - + public function getDescription() { return $this->description; } - + public function setDescription($description) { $this->description = $description; } - + public function setProduct(ECommerceProduct $product) { $this->product = $product; } - + public function removeProduct() { if ($this->product !== null) { $product = $this->product; @@ -52,7 +52,7 @@ class ECommerceFeature $product->removeFeature($this); } } - + public function getProduct() { return $this->product; } diff --git a/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php b/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php index f843436b7..f053fd2cb 100644 --- a/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php +++ b/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php @@ -46,7 +46,7 @@ class ECommerceProduct private $categories; /** - * This relation is saved with two records in the association table for + * This relation is saved with two records in the association table for * simplicity. * @ManyToMany(targetEntity="ECommerceProduct", cascade={"persist"}) * @JoinTable(name="ecommerce_products_related", diff --git a/tests/Doctrine/Tests/Models/Forum/ForumUser.php b/tests/Doctrine/Tests/Models/Forum/ForumUser.php index e27623160..3f3b5d9d2 100644 --- a/tests/Doctrine/Tests/Models/Forum/ForumUser.php +++ b/tests/Doctrine/Tests/Models/Forum/ForumUser.php @@ -22,19 +22,19 @@ class ForumUser * @JoinColumn(name="avatar_id", referencedColumnName="id") */ public $avatar; - + public function getId() { return $this->id; } - + public function getUsername() { return $this->username; } - + public function getAvatar() { return $this->avatar; } - + public function setAvatar(ForumAvatar $avatar) { $this->avatar = $avatar; } diff --git a/tests/Doctrine/Tests/ORM/CommitOrderCalculatorTest.php b/tests/Doctrine/Tests/ORM/CommitOrderCalculatorTest.php index d51aa344a..ff8205987 100644 --- a/tests/Doctrine/Tests/ORM/CommitOrderCalculatorTest.php +++ b/tests/Doctrine/Tests/ORM/CommitOrderCalculatorTest.php @@ -16,12 +16,12 @@ require_once __DIR__ . '/../TestInit.php'; class CommitOrderCalculatorTest extends \Doctrine\Tests\OrmTestCase { private $_calc; - + protected function setUp() { $this->_calc = new \Doctrine\ORM\Internal\CommitOrderCalculator(); } - + public function testCommitOrdering1() { $class1 = new ClassMetadata(__NAMESPACE__ . '\NodeClass1'); @@ -29,20 +29,20 @@ class CommitOrderCalculatorTest extends \Doctrine\Tests\OrmTestCase $class3 = new ClassMetadata(__NAMESPACE__ . '\NodeClass3'); $class4 = new ClassMetadata(__NAMESPACE__ . '\NodeClass4'); $class5 = new ClassMetadata(__NAMESPACE__ . '\NodeClass5'); - + $this->_calc->addClass($class1); $this->_calc->addClass($class2); $this->_calc->addClass($class3); $this->_calc->addClass($class4); $this->_calc->addClass($class5); - + $this->_calc->addDependency($class1, $class2); $this->_calc->addDependency($class2, $class3); $this->_calc->addDependency($class3, $class4); $this->_calc->addDependency($class5, $class1); $sorted = $this->_calc->getCommitOrder(); - + // There is only 1 valid ordering for this constellation $correctOrder = array($class5, $class1, $class2, $class3, $class4); $this->assertSame($correctOrder, $sorted); diff --git a/tests/Doctrine/Tests/ORM/Criteria/DqlGenerationTest.php b/tests/Doctrine/Tests/ORM/Criteria/DqlGenerationTest.php index f2d223d02..b3aa60792 100644 --- a/tests/Doctrine/Tests/ORM/Criteria/DqlGenerationTest.php +++ b/tests/Doctrine/Tests/ORM/Criteria/DqlGenerationTest.php @@ -39,7 +39,7 @@ class DqlGenerationTest extends \Doctrine\Tests\OrmTestCase protected function setUp() { $this->markTestSkipped('Not yet implemented.'); } - + protected function createQuery() { return $this->_em->createQuery(); diff --git a/tests/Doctrine/Tests/ORM/Entity/ConstructorTest.php b/tests/Doctrine/Tests/ORM/Entity/ConstructorTest.php index e21176487..014a7b421 100644 --- a/tests/Doctrine/Tests/ORM/Entity/ConstructorTest.php +++ b/tests/Doctrine/Tests/ORM/Entity/ConstructorTest.php @@ -3,13 +3,13 @@ namespace Doctrine\Tests\ORM\Entity; require_once __DIR__ . '/../../TestInit.php'; - + class ConstructorTest extends \Doctrine\Tests\OrmTestCase { public function testFieldInitializationInConstructor() { $entity = new ConstructorTestEntity1("romanb"); - $this->assertEquals("romanb", $entity->username); + $this->assertEquals("romanb", $entity->username); } } diff --git a/tests/Doctrine/Tests/ORM/EntityManagerTest.php b/tests/Doctrine/Tests/ORM/EntityManagerTest.php index f54974a27..5f1578153 100644 --- a/tests/Doctrine/Tests/ORM/EntityManagerTest.php +++ b/tests/Doctrine/Tests/ORM/EntityManagerTest.php @@ -143,7 +143,7 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase $this->_em->close(); $this->_em->$methodName(new \stdClass()); } - + /** * @group DDC-1125 */ @@ -152,7 +152,7 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase $return = $this->_em->transactional(function ($em) { return 'foo'; }); - + $this->assertEquals('foo', $return); } } \ No newline at end of file diff --git a/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php index c4e43dfad..f15279672 100644 --- a/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php @@ -16,8 +16,8 @@ class AdvancedAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCase protected function setUp() { parent::setUp(); try { - $this->_schemaTool->createSchema(array( - $this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Phrase'), + $this->_schemaTool->createSchema(array( + $this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Phrase'), $this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\PhraseType'), $this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Definition'), $this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Lemma'), @@ -33,33 +33,33 @@ class AdvancedAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCase //setup $phrase = new Phrase; $phrase->setPhrase('lalala'); - + $type = new PhraseType; $type->setType('nonsense'); $type->setAbbreviation('non'); - + $def1 = new Definition; $def1->setDefinition('def1'); $def2 = new Definition; $def2->setDefinition('def2'); - + $phrase->setType($type); $phrase->addDefinition($def1); $phrase->addDefinition($def2); - + $this->_em->persist($phrase); $this->_em->persist($type); - + $this->_em->flush(); $this->_em->clear(); //end setup - + // test1 - lazy-loading many-to-one after find() $phrase2 = $this->_em->find('Doctrine\Tests\ORM\Functional\Phrase', $phrase->getId()); $this->assertTrue(is_numeric($phrase2->getType()->getId())); - + $this->_em->clear(); - + // test2 - eager load in DQL query $query = $this->_em->createQuery("SELECT p,t FROM Doctrine\Tests\ORM\Functional\Phrase p JOIN p.type t"); $res = $query->getResult(); @@ -67,9 +67,9 @@ class AdvancedAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCase $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(); - + // test2 - eager load in DQL query with double-join back and forth $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(); @@ -77,48 +77,48 @@ class AdvancedAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCase $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(); - + // test3 - lazy-loading one-to-many after find() $phrase3 = $this->_em->find('Doctrine\Tests\ORM\Functional\Phrase', $phrase->getId()); $definitions = $phrase3->getDefinitions(); $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $definitions); $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Definition', $definitions[0]); - + $this->_em->clear(); - + // test4 - lazy-loading after DQL query $query = $this->_em->createQuery("SELECT p FROM Doctrine\Tests\ORM\Functional\Phrase p"); $res = $query->getResult(); $definitions = $res[0]->getDefinitions(); - + $this->assertEquals(1, count($res)); - + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Definition', $definitions[0]); $this->assertEquals(2, $definitions->count()); } - + public function testManyToMany() { $lemma = new Lemma; $lemma->setLemma('abu'); - + $type = new Type(); $type->setType('nonsense'); $type->setAbbreviation('non'); - + $lemma->addType($type); - + $this->_em->persist($lemma); $this->_em->persist($type); $this->_em->flush(); - + // test5 ManyToMany $query = $this->_em->createQuery("SELECT l FROM Doctrine\Tests\ORM\Functional\Lemma l"); $res = $query->getResult(); $types = $res[0]->getTypes(); - + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Type', $types[0]); } } @@ -181,9 +181,9 @@ class Lemma { public function getLemma(){ return $this->lemma; } - + /** - * + * * @param kateglo\application\models\Type $type * @return void */ @@ -195,7 +195,7 @@ class Lemma { } /** - * + * * @param kateglo\application\models\Type $type * @return void */ @@ -208,7 +208,7 @@ class Lemma { } /** - * + * * @return kateglo\application\helpers\collections\ArrayCollection */ public function getTypes() @@ -261,7 +261,7 @@ class Type { public function __construct(){ $this->lemmas = new \Doctrine\Common\Collections\ArrayCollection(); } - + /** * * @return int @@ -305,7 +305,7 @@ class Type { } /** - * + * * @param kateglo\application\models\Lemma $lemma * @return void */ @@ -318,7 +318,7 @@ class Type { } /** - * + * * @param kateglo\application\models\Lemma $lemma * @return void */ @@ -331,7 +331,7 @@ class Type { } /** - * + * * @return kateglo\application\helpers\collections\ArrayCollection */ public function getCategories() @@ -367,7 +367,7 @@ class Phrase { * @JoinColumn(name="phrase_type_id", referencedColumnName="phrase_type_id") */ private $type; - + /** * @OneToMany(targetEntity="Definition", mappedBy="phrase", cascade={"persist"}) */ @@ -376,9 +376,9 @@ class Phrase { public function __construct() { $this->definitions = new \Doctrine\Common\Collections\ArrayCollection; } - + /** - * + * * @param Definition $definition * @return void */ @@ -386,14 +386,14 @@ class Phrase { $this->definitions[] = $definition; $definition->setPhrase($this); } - + /** * @return int */ public function getId(){ return $this->id; } - + /** * @param string $phrase * @return void @@ -401,14 +401,14 @@ class Phrase { public function setPhrase($phrase){ $this->phrase = $phrase; } - + /** * @return string */ public function getPhrase(){ return $this->phrase; } - + /** * * @param PhraseType $type @@ -417,7 +417,7 @@ class Phrase { public function setType(PhraseType $type){ $this->type = $type; } - + /** * * @return PhraseType @@ -425,9 +425,9 @@ class Phrase { public function getType(){ return $this->type; } - + /** - * + * * @return ArrayCollection */ public function getDefinitions(){ @@ -440,42 +440,42 @@ class Phrase { * @Table(name="phrase_type") */ class PhraseType { - + const CLASS_NAME = __CLASS__; - + /** * @Id * @Column(type="integer", name="phrase_type_id") * @GeneratedValue(strategy="AUTO") */ private $id; - + /** * @Column(type="string", name="phrase_type_name", unique=true) */ private $type; - + /** * @Column(type="string", name="phrase_type_abbreviation", unique=true) */ private $abbreviation; - + /** * @OneToMany(targetEntity="Phrase", mappedBy="type") */ private $phrases; - + public function __construct() { $this->phrases = new \Doctrine\Common\Collections\ArrayCollection; } - + /** * @return int */ public function getId(){ return $this->id; } - + /** * @param string $type * @return void @@ -483,14 +483,14 @@ class PhraseType { public function setType($type){ $this->type = $type; } - + /** * @return string */ public function getType(){ return $this->type; } - + /** * @param string $abbreviation * @return void @@ -498,14 +498,14 @@ class PhraseType { public function setAbbreviation($abbreviation){ $this->abbreviation = $abbreviation; } - + /** * @return string */ public function getAbbreviation(){ return $this->abbreviation; } - + /** * @param ArrayCollection $phrases * @return void @@ -513,15 +513,15 @@ class PhraseType { public function setPhrases($phrases){ $this->phrases = $phrases; } - + /** - * + * * @return ArrayCollection */ public function getPhrases(){ return $this->phrases; } - + } /** @@ -529,34 +529,34 @@ class PhraseType { * @Table(name="definition") */ class Definition { - + const CLASS_NAME = __CLASS__; - + /** * @Id * @Column(type="integer", name="definition_id") * @GeneratedValue(strategy="AUTO") */ private $id; - + /** * @ManyToOne(targetEntity="Phrase") * @JoinColumn(name="definition_phrase_id", referencedColumnName="phrase_id") */ private $phrase; - + /** * @Column(type="text", name="definition_text") */ private $definition; - + /** * @return int */ public function getId(){ return $this->id; } - + /** * @param Phrase $phrase * @return void @@ -564,14 +564,14 @@ class Definition { public function setPhrase(Phrase $phrase){ $this->phrase = $phrase; } - + /** * @return Phrase */ public function getPhrase(){ return $this->phrase; } - + public function removePhrase() { if ($this->phrase !== null) { /*@var $phrase kateglo\application\models\Phrase */ @@ -580,7 +580,7 @@ class Definition { $phrase->removeDefinition($this); } } - + /** * @param string $definition * @return void @@ -588,7 +588,7 @@ class Definition { public function setDefinition($definition){ $this->definition = $definition; } - + /** * @return string */ diff --git a/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php b/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php index 77c964eea..9b68098c0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php @@ -29,9 +29,9 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $user->username = 'romanb'; $user->status = 'developer'; $this->_em->persist($user); - + $this->_em->flush(); - + $this->assertTrue(is_numeric($user->id)); $this->assertTrue($this->_em->contains($user)); @@ -128,18 +128,18 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase "SELECT user_id FROM cms_addresses WHERE id=?", array($address->id) )->fetchColumn(); $this->assertTrue(is_numeric($userId)); - + $this->_em->clear(); - + $user2 = $this->_em->createQuery('select u from \Doctrine\Tests\Models\CMS\CmsUser u where u.id=?1') ->setParameter(1, $userId) ->getSingleResult(); - + // Address has been eager-loaded because it cant be lazy $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $user2->address); $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $user2->address); } - + /** * @group DDC-1230 */ @@ -151,29 +151,29 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $user->status = 'developer'; $this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_NEW, $this->_em->getUnitOfWork()->getEntityState($user), "State should be UnitOfWork::STATE_NEW"); - + $this->_em->persist($user); - + $this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_MANAGED, $this->_em->getUnitOfWork()->getEntityState($user), "State should be UnitOfWork::STATE_MANAGED"); - + $this->_em->remove($user); $this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_NEW, $this->_em->getUnitOfWork()->getEntityState($user), "State should be UnitOfWork::STATE_NEW"); - + $this->_em->persist($user); $this->_em->flush(); $id = $user->getId(); - + $this->_em->remove($user); - + $this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_REMOVED, $this->_em->getUnitOfWork()->getEntityState($user), "State should be UnitOfWork::STATE_REMOVED"); $this->_em->flush(); - + $this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_NEW, $this->_em->getUnitOfWork()->getEntityState($user), "State should be UnitOfWork::STATE_NEW"); - + $this->assertNull($this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $id)); } - + public function testOneToManyOrphanRemoval() { $user = new CmsUser; @@ -281,7 +281,7 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertEquals(0, $users[0]->phonenumbers->count()); //$this->assertNull($users[0]->articles); } - + public function testBasicRefresh() { $user = new CmsUser; @@ -291,9 +291,9 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->persist($user); $this->_em->flush(); - + $user->status = 'mascot'; - + $this->assertEquals('mascot', $user->status); $this->_em->refresh($user); $this->assertEquals('developer', $user->status); @@ -394,7 +394,7 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $userId = $user->id; $user = $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsUser', $user->id); - + $dql = "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = ?1"; $user = $this->_em->createQuery($dql) ->setParameter(1, $userId) @@ -419,30 +419,30 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->persist($user); $this->_em->flush(); $this->_em->clear(); - + $this->assertEquals(3, $user->getPhonenumbers()->count()); - + $query = $this->_em->createQuery("select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username='gblanco'"); $gblanco = $query->getSingleResult(); - + $this->assertFalse($gblanco->getPhonenumbers()->isInitialized()); - + $newPhone = new CmsPhonenumber; $newPhone->phonenumber = 555; $gblanco->addPhonenumber($newPhone); - + $this->assertFalse($gblanco->getPhonenumbers()->isInitialized()); $this->_em->persist($gblanco); $this->_em->flush(); $this->_em->clear(); - + $query = $this->_em->createQuery("select u, p from Doctrine\Tests\Models\CMS\CmsUser u join u.phonenumbers p where u.username='gblanco'"); $gblanco2 = $query->getSingleResult(); $this->assertEquals(4, $gblanco2->getPhonenumbers()->count()); } - + public function testInitializeCollectionWithNewObjectsRetainsNewObjects() { $user = new CmsUser; @@ -459,63 +459,63 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->persist($user); $this->_em->flush(); $this->_em->clear(); - + $this->assertEquals(3, $user->getPhonenumbers()->count()); - + $query = $this->_em->createQuery("select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username='gblanco'"); $gblanco = $query->getSingleResult(); - + $this->assertFalse($gblanco->getPhonenumbers()->isInitialized()); - + $newPhone = new CmsPhonenumber; $newPhone->phonenumber = 555; $gblanco->addPhonenumber($newPhone); - + $this->assertFalse($gblanco->getPhonenumbers()->isInitialized()); $this->assertEquals(4, $gblanco->getPhonenumbers()->count()); $this->assertTrue($gblanco->getPhonenumbers()->isInitialized()); $this->_em->flush(); $this->_em->clear(); - + $query = $this->_em->createQuery("select u, p from Doctrine\Tests\Models\CMS\CmsUser u join u.phonenumbers p where u.username='gblanco'"); $gblanco2 = $query->getSingleResult(); $this->assertEquals(4, $gblanco2->getPhonenumbers()->count()); } - + public function testSetSetAssociationWithGetReference() { $user = new CmsUser; $user->name = 'Guilherme'; $user->username = 'gblanco'; - $user->status = 'developer'; + $user->status = 'developer'; $this->_em->persist($user); - + $address = new CmsAddress; $address->country = 'Germany'; $address->city = 'Berlin'; $address->zip = '12345'; $this->_em->persist($address); - + $this->_em->flush(); $this->_em->detach($address); - + $this->assertFalse($this->_em->contains($address)); $this->assertTrue($this->_em->contains($user)); - + // Assume we only got the identifier of the address and now want to attach // that address to the user without actually loading it, using getReference(). $addressRef = $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsAddress', $address->getId()); - + //$addressRef->getId(); //\Doctrine\Common\Util\Debug::dump($addressRef); - + $user->setAddress($addressRef); // Ugh! Initializes address 'cause of $address->setUser($user)! - + $this->_em->flush(); $this->_em->clear(); - + // Check with a fresh load that the association is indeed there $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(); @@ -523,9 +523,9 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $gblanco); $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $gblanco->getAddress()); $this->assertEquals('Berlin', $gblanco->getAddress()->getCity()); - + } - + public function testOneToManyCascadeRemove() { $user = new CmsUser; @@ -542,19 +542,19 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->persist($user); $this->_em->flush(); $this->_em->clear(); - + $query = $this->_em->createQuery("select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username='gblanco'"); $gblanco = $query->getSingleResult(); - + $this->_em->remove($gblanco); $this->_em->flush(); - + $this->_em->clear(); - + $this->assertEquals(0, $this->_em->createQuery( "select count(p.phonenumber) from Doctrine\Tests\Models\CMS\CmsPhonenumber p") ->getSingleScalarResult()); - + $this->assertEquals(0, $this->_em->createQuery( "select count(u.id) from Doctrine\Tests\Models\CMS\CmsUser u") ->getSingleScalarResult()); @@ -584,7 +584,7 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $articleNew = $this->_em->find('\Doctrine\Tests\Models\CMS\CmsArticle', $articleId); $this->assertTrue($this->_em->contains($articleNew)); $this->assertEquals("Lorem ipsum dolor sunt.", $articleNew->text); - + $this->assertNotSame($article, $articleNew); $articleNew->text = "Lorem ipsum dolor sunt. And stuff!"; @@ -603,64 +603,64 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $user->name = 'Guilherme'; $user->username = 'gblanco'; $user->status = 'developer'; - + $address = new CmsAddress; $address->country = 'Germany'; $address->city = 'Berlin'; $address->zip = '12345'; - + $address->user = $user; $user->address = $address; - + $article = new \Doctrine\Tests\Models\CMS\CmsArticle(); $article->text = "Lorem ipsum dolor sunt."; $article->topic = "A Test Article!"; $article->setAuthor($user); - + $this->_em->persist($article); $this->_em->persist($user); - + //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger); - + $this->_em->flush(); $this->_em->clear(); - + $query = $this->_em->createQuery('select u,a,ad from Doctrine\Tests\Models\CMS\CmsUser u join u.articles a join u.address ad'); $user2 = $query->getSingleResult(); $this->assertEquals(1, count($user2->articles)); $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $user2->address); - + $oldLogger = $this->_em->getConnection()->getConfiguration()->getSQLLogger(); $debugStack = new \Doctrine\DBAL\Logging\DebugStack; $this->_em->getConnection()->getConfiguration()->setSQLLogger($debugStack); - + $this->_em->flush(); $this->assertEquals(0, count($debugStack->queries)); - + $this->_em->getConnection()->getConfiguration()->setSQLLogger($oldLogger); } - + public function testRemoveEntityByReference() { $user = new CmsUser; $user->name = 'Guilherme'; $user->username = 'gblanco'; $user->status = 'developer'; - + //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger); - + $this->_em->persist($user); $this->_em->flush(); $this->_em->clear(); - + $userRef = $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsUser', $user->getId()); $this->_em->remove($userRef); $this->_em->flush(); $this->_em->clear(); - + $this->assertEquals(0, $this->_em->getConnection()->fetchColumn("select count(*) from cms_users")); - + //$this->_em->getConnection()->getConfiguration()->setSQLLogger(null); } @@ -670,26 +670,26 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $user->name = 'Guilherme'; $user->username = 'gblanco'; $user->status = 'developer'; - + $address = new CmsAddress; $address->country = 'Germany'; $address->city = 'Berlin'; $address->zip = '12345'; - + $user->setAddress($address); $this->_em->transactional(function($em) use($user) { $em->persist($user); }); $this->_em->clear(); - + //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger); - + $userRef = $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsUser', $user->getId()); $address2 = $this->_em->createQuery('select a from Doctrine\Tests\Models\CMS\CmsAddress a where a.user = :user') ->setParameter('user', $userRef) ->getSingleResult(); - + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $address2->getUser()); $this->assertTrue($userRef === $address2->getUser()); $this->assertFalse($userRef->__isInitialized__); @@ -801,7 +801,7 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase $com->topic = 'Good'; $com->text = 'Really good!'; $art->addComment($com); - + $this->_em->persist($art); // pretend we forgot to persist $com try { diff --git a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php index e8768e7ff..83320dfc7 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php @@ -30,7 +30,7 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase { $person = new CompanyPerson; $person->setName('Roman S. Borschel'); - + $this->_em->persist($person); $employee = new CompanyEmployee; @@ -44,7 +44,7 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->flush(); $this->_em->clear(); - + $query = $this->_em->createQuery("select p from Doctrine\Tests\Models\Company\CompanyPerson p order by p.name desc"); $entities = $query->getResult(); @@ -59,7 +59,7 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertEquals(100000, $entities[1]->getSalary()); $this->_em->clear(); - + $query = $this->_em->createQuery("select p from Doctrine\Tests\Models\Company\CompanyEmployee p"); $entities = $query->getResult(); @@ -71,13 +71,13 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertEquals(100000, $entities[0]->getSalary()); $this->_em->clear(); - + $guilherme = $this->_em->getRepository(get_class($employee))->findOneBy(array('name' => 'Guilherme Blanco')); $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $guilherme); $this->assertEquals('Guilherme Blanco', $guilherme->getName()); $this->_em->clear(); - + $query = $this->_em->createQuery("update Doctrine\Tests\Models\Company\CompanyEmployee p set p.name = ?1, p.department = ?2 where p.name='Guilherme Blanco' and p.salary = ?3"); $query->setParameter(1, 'NewName', 'string'); $query->setParameter(2, 'NewDepartment'); @@ -85,12 +85,12 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $query->getSql(); $numUpdated = $query->execute(); $this->assertEquals(1, $numUpdated); - + $query = $this->_em->createQuery("delete from Doctrine\Tests\Models\Company\CompanyPerson p"); $numDeleted = $query->execute(); $this->assertEquals(2, $numDeleted); } - + public function testMultiLevelUpdateAndFind() { $manager = new CompanyManager; $manager->setName('Roman S. Borschel'); @@ -99,24 +99,24 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $manager->setTitle('CTO'); $this->_em->persist($manager); $this->_em->flush(); - + $manager->setName('Roman B.'); $manager->setSalary(119000); $manager->setTitle('CEO'); $this->_em->persist($manager); $this->_em->flush(); - + $this->_em->clear(); - + $manager = $this->_em->find('Doctrine\Tests\Models\Company\CompanyManager', $manager->getId()); - + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyManager', $manager); $this->assertEquals('Roman B.', $manager->getName()); $this->assertEquals(119000, $manager->getSalary()); $this->assertEquals('CEO', $manager->getTitle()); $this->assertTrue(is_numeric($manager->getId())); } - + public function testFindOnBaseClass() { $manager = new CompanyManager; $manager->setName('Roman S. Borschel'); @@ -125,11 +125,11 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $manager->setTitle('CTO'); $this->_em->persist($manager); $this->_em->flush(); - + $this->_em->clear(); - + $person = $this->_em->find('Doctrine\Tests\Models\Company\CompanyPerson', $manager->getId()); - + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyManager', $person); $this->assertEquals('Roman S. Borschel', $person->getName()); $this->assertEquals(100000, $person->getSalary()); @@ -137,34 +137,34 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertTrue(is_numeric($person->getId())); //$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyCar', $person->getCar()); } - + public function testSelfReferencingOneToOne() { $manager = new CompanyManager; $manager->setName('John Smith'); $manager->setSalary(100000); $manager->setDepartment('IT'); $manager->setTitle('CTO'); - + $wife = new CompanyPerson; $wife->setName('Mary Smith'); $wife->setSpouse($manager); - + $this->assertSame($manager, $wife->getSpouse()); $this->assertSame($wife, $manager->getSpouse()); - + $this->_em->persist($manager); $this->_em->persist($wife); - + $this->_em->flush(); - + //var_dump($this->_em->getConnection()->fetchAll('select * from company_persons')); //var_dump($this->_em->getConnection()->fetchAll('select * from company_employees')); //var_dump($this->_em->getConnection()->fetchAll('select * from company_managers')); - + $this->_em->clear(); - + $query = $this->_em->createQuery('select p, s from Doctrine\Tests\Models\Company\CompanyPerson p join p.spouse s where p.name=\'Mary Smith\''); - + $result = $query->getResult(); $this->assertEquals(1, count($result)); $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyPerson', $result[0]); @@ -173,40 +173,40 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertEquals('John Smith', $result[0]->getSpouse()->getName()); $this->assertSame($result[0], $result[0]->getSpouse()->getSpouse()); } - + public function testSelfReferencingManyToMany() { $person1 = new CompanyPerson; $person1->setName('Roman'); - + $person2 = new CompanyPerson; $person2->setName('Jonathan'); - + $person1->addFriend($person2); - + $this->assertEquals(1, count($person1->getFriends())); $this->assertEquals(1, count($person2->getFriends())); - - + + $this->_em->persist($person1); $this->_em->persist($person2); - + $this->_em->flush(); - + $this->_em->clear(); - + $query = $this->_em->createQuery('select p, f from Doctrine\Tests\Models\Company\CompanyPerson p join p.friends f where p.name=?1'); $query->setParameter(1, 'Roman'); - + $result = $query->getResult(); $this->assertEquals(1, count($result)); $this->assertEquals(1, count($result[0]->getFriends())); $this->assertEquals('Roman', $result[0]->getName()); - + $friends = $result[0]->getFriends(); $this->assertEquals('Jonathan', $friends[0]->getName()); } - + public function testLazyLoading1() { $org = new CompanyOrganization; @@ -216,27 +216,27 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $event2 = new CompanyRaffle; $event2->setData('raffle'); $org->addEvent($event2); - + $this->_em->persist($org); $this->_em->flush(); $this->_em->clear(); - + $orgId = $org->getId(); - + $q = $this->_em->createQuery('select a from Doctrine\Tests\Models\Company\CompanyOrganization a where a.id = ?1'); $q->setParameter(1, $orgId); - + $result = $q->getResult(); - + $this->assertEquals(1, count($result)); $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyOrganization', $result[0]); $this->assertNull($result[0]->getMainEvent()); - + $events = $result[0]->getEvents(); - + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $events); $this->assertFalse($events->isInitialized()); - + $this->assertEquals(2, count($events)); if ($events[0] instanceof CompanyAuction) { $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyRaffle', $events[1]); @@ -246,7 +246,7 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase } } - + public function testLazyLoading2() { $org = new CompanyOrganization; @@ -280,7 +280,7 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyAuction', $mainEvent); $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $mainEvent); } - + /** * @group DDC-368 */ @@ -291,9 +291,9 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertTrue(count($this->_em->createQuery( 'SELECT count(p.id) FROM Doctrine\Tests\Models\Company\CompanyEmployee p WHERE p.salary = 1') - ->getResult()) > 0); + ->getResult()) > 0); } - + /** * @group DDC-1341 */ @@ -303,7 +303,7 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $query = $this->_em->createQuery($dql) ->setParameter(0, new \DateTime()) ->setParameter(1, 'IT'); - + $result = $query->execute(); } diff --git a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php index e558f2abb..531b10020 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php +++ b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php @@ -24,30 +24,30 @@ class ClassTableInheritanceTest2 extends \Doctrine\Tests\OrmFunctionalTestCase // Swallow all exceptions. We do not test the schema tool here. } } - + public function testOneToOneAssocToBaseTypeBidirectional() { $child = new CTIChild; $child->setData('hello'); - + $related = new CTIRelated; $related->setCTIParent($child); - + $this->_em->persist($related); $this->_em->persist($child); - + $this->_em->flush(); $this->_em->clear(); - + $relatedId = $related->getId(); - + $related2 = $this->_em->find('Doctrine\Tests\ORM\Functional\CTIRelated', $relatedId); - + $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()); } @@ -85,18 +85,18 @@ class CTIParent { * @GeneratedValue(strategy="AUTO") */ private $id; - + /** @OneToOne(targetEntity="CTIRelated", mappedBy="ctiParent") */ private $related; - + public function getId() { return $this->id; } - + public function getRelated() { return $this->related; - } - + } + public function setRelated($related) { $this->related = $related; $related->setCTIParent($this); @@ -111,15 +111,15 @@ class CTIChild extends CTIParent { * @Column(type="string") */ private $data; - + public function getData() { return $this->data; } - + public function setData($data) { $this->data = $data; } - + } /** @Entity */ @@ -129,21 +129,21 @@ class CTIRelated { * @GeneratedValue(strategy="AUTO") */ private $id; - + /** * @OneToOne(targetEntity="CTIParent") * @JoinColumn(name="ctiparent_id", referencedColumnName="id") */ private $ctiParent; - + public function getId() { return $this->id; } - + public function getCTIParent() { return $this->ctiParent; } - + public function setCTIParent($ctiParent) { $this->ctiParent = $ctiParent; } diff --git a/tests/Doctrine/Tests/ORM/Functional/CompositePrimaryKeyTest.php b/tests/Doctrine/Tests/ORM/Functional/CompositePrimaryKeyTest.php index 15f7e0bda..80e2fa0d6 100644 --- a/tests/Doctrine/Tests/ORM/Functional/CompositePrimaryKeyTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/CompositePrimaryKeyTest.php @@ -42,7 +42,7 @@ class CompositePrimaryKeyTest extends \Doctrine\Tests\OrmFunctionalTestCase public function testPersistCompositePkEntity() { $this->putGermanysBrandenburderTor(); - + $poi = $this->_em->find('Doctrine\Tests\Models\Navigation\NavPointOfInterest', array('lat' => 100, 'long' => 200)); $this->assertInstanceOf('Doctrine\Tests\Models\Navigation\NavPointOfInterest', $poi); @@ -71,7 +71,7 @@ class CompositePrimaryKeyTest extends \Doctrine\Tests\OrmFunctionalTestCase $tours = $this->_em->createQuery($dql)->getResult(); $this->assertEquals(1, count($tours)); - + $pois = $tours[0]->getPointOfInterests(); $this->assertEquals(1, count($pois)); @@ -92,7 +92,7 @@ class CompositePrimaryKeyTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertEquals(1, count($tours)); } - + public function testSpecifiyUnknownIdentifierPrimaryKeyFails() { $this->setExpectedException('Doctrine\ORM\ORMException', 'The identifier long is missing for a query of Doctrine\Tests\Models\Navigation\NavPointOfInterest'); diff --git a/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php b/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php index 2e17ccf12..11511a079 100644 --- a/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php @@ -29,26 +29,26 @@ class DefaultValuesTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->persist($user); $this->_em->flush(); $this->_em->clear(); - + $userId = $user->id; // e.g. from $_REQUEST $user2 = $this->_em->getReference(get_class($user), $userId); - + $this->_em->flush(); $this->assertFalse($user2->__isInitialized__); - + $a = new DefaultValueAddress; $a->country = 'de'; $a->zip = '12345'; $a->city = 'Berlin'; $a->street = 'Sesamestreet'; - + $a->user = $user2; $this->_em->persist($a); $this->_em->flush(); - + $this->assertFalse($user2->__isInitialized__); $this->_em->clear(); - + $a2 = $this->_em->find(get_class($a), $a->id); $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\DefaultValueUser', $a2->getUser()); $this->assertEquals($userId, $a2->getUser()->getId()); @@ -63,7 +63,7 @@ class DefaultValuesTest extends \Doctrine\Tests\OrmFunctionalTestCase $user = new DefaultValueUser; $user->name = 'romanb'; $user->type = 'Normaluser'; - + $this->_em->persist($user); $this->_em->flush(); $this->_em->clear(); @@ -103,7 +103,7 @@ class DefaultValueUser * @OneToOne(targetEntity="DefaultValueAddress", mappedBy="user", cascade={"persist"}) */ public $address; - + public function getId() {return $this->id;} } @@ -145,6 +145,6 @@ class DefaultValueAddress * @JoinColumn(name="user_id", referencedColumnName="id") */ public $user; - + public function getUser() {return $this->user;} } diff --git a/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php b/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php index ee265d0ea..f5c50eb11 100644 --- a/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php @@ -53,7 +53,7 @@ class DetachedEntityTest extends \Doctrine\Tests\OrmFunctionalTestCase $user->name = 'Guilherme'; $user->username = 'gblanco'; $user->status = 'developer'; - + $ph1 = new CmsPhonenumber; $ph1->phonenumber = "1234"; $user->addPhonenumber($ph1); @@ -62,23 +62,23 @@ class DetachedEntityTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->flush(); $this->assertTrue($this->_em->contains($user)); $this->assertTrue($user->phonenumbers->isInitialized()); - + $serialized = serialize($user); $this->_em->clear(); - $this->assertFalse($this->_em->contains($user)); + $this->assertFalse($this->_em->contains($user)); unset($user); - + $user = unserialize($serialized); $this->assertEquals(1, count($user->getPhonenumbers()), "Pre-Condition: 1 Phonenumber"); - + $ph2 = new CmsPhonenumber; $ph2->phonenumber = "56789"; $user->addPhonenumber($ph2); $oldPhonenumbers = $user->getPhonenumbers(); $this->assertEquals(2, count($oldPhonenumbers), "Pre-Condition: 2 Phonenumbers"); $this->assertFalse($this->_em->contains($user)); - + $this->_em->persist($ph2); // Merge back in @@ -87,7 +87,7 @@ class DetachedEntityTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $user->phonenumbers[1]->user); $im = $this->_em->getUnitOfWork()->getIdentityMap(); $this->_em->flush(); - + $this->assertTrue($this->_em->contains($user), "Failed to assert that merged user is contained inside EntityManager persistence context."); $phonenumbers = $user->getPhonenumbers(); $this->assertNotSame($oldPhonenumbers, $phonenumbers, "Merge should replace the Detached Collection with a new PersistentCollection."); diff --git a/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php b/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php index 1bf704a89..0e3be4d25 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php @@ -25,7 +25,7 @@ class ExtraLazyCollectionTest extends \Doctrine\Tests\OrmFunctionalTestCase $class = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsUser'); $class->associationMappings['groups']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; $class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; - + $class = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsGroup'); $class->associationMappings['users']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; diff --git a/tests/Doctrine/Tests/ORM/Functional/FlushEventTest.php b/tests/Doctrine/Tests/ORM/Functional/FlushEventTest.php index 2b1d7260c..8167e8587 100644 --- a/tests/Doctrine/Tests/ORM/Functional/FlushEventTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/FlushEventTest.php @@ -25,24 +25,24 @@ class FlushEventTest extends \Doctrine\Tests\OrmFunctionalTestCase { //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger); $this->_em->getEventManager()->addEventListener(Events::onFlush, new OnFlushListener); - + $user = new CmsUser; $user->username = 'romanb'; $user->name = 'Roman'; $user->status = 'Dev'; - + $this->_em->persist($user); - + $this->assertEquals(0, $user->phonenumbers->count()); - + $this->_em->flush(); - + $this->assertEquals(1, $user->phonenumbers->count()); $this->assertTrue($this->_em->contains($user->phonenumbers->get(0))); $this->assertTrue($user->phonenumbers->get(0)->getUser() === $user); - + $this->assertFalse($user->phonenumbers->isDirty()); - + // Can be used together with SQL Logging to check that a subsequent flush has // nothing to do. This proofs the correctness of the changes that happened in onFlush. //echo "SECOND FLUSH"; @@ -55,15 +55,15 @@ class OnFlushListener public function onFlush(OnFlushEventArgs $args) { //echo "---preFlush".PHP_EOL; - + $em = $args->getEntityManager(); $uow = $em->getUnitOfWork(); - + foreach ($uow->getScheduledEntityInsertions() as $entity) { - + if ($entity instanceof CmsUser) { // Adds a phonenumber to every newly persisted CmsUser ... - + $phone = new CmsPhonenumber; $phone->phonenumber = 12345; // Update object model @@ -73,20 +73,20 @@ class OnFlushListener // Explicitly calculate the changeset since onFlush is raised // after changeset calculation! $uow->computeChangeSet($em->getClassMetadata(get_class($phone)), $phone); - + // Take a snapshot because the UoW wont do this for us, because // the UoW did not visit this collection. // Alternatively we could provide an ->addVisitedCollection() method // on the UoW. $entity->getPhonenumbers()->takeSnapshot(); } - + /*foreach ($uow->getEntityChangeSet($entity) as $field => $change) { list ($old, $new) = $change; var_dump($old); }*/ - + } } } diff --git a/tests/Doctrine/Tests/ORM/Functional/IdentityMapTest.php b/tests/Doctrine/Tests/ORM/Functional/IdentityMapTest.php index 8d39c235e..84d0064a9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/IdentityMapTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/IdentityMapTest.php @@ -11,7 +11,7 @@ require_once __DIR__ . '/../../TestInit.php'; /** * IdentityMapTest - * + * * Tests correct behavior and usage of the identity map. Local values and associations * that are already fetched always prevail, unless explicitly refreshed. * @@ -23,45 +23,45 @@ class IdentityMapTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->useModelSet('cms'); parent::setUp(); } - + public function testBasicIdentityManagement() { $user = new CmsUser; $user->status = 'dev'; $user->username = 'romanb'; $user->name = 'Roman B.'; - + $address = new CmsAddress; $address->country = 'de'; $address->zip = 1234; $address->city = 'Berlin'; - + $user->setAddress($address); - + $this->_em->persist($user); $this->_em->flush(); $this->_em->clear(); - + $user2 = $this->_em->find(get_class($user), $user->getId()); $this->assertTrue($user2 !== $user); $user3 = $this->_em->find(get_class($user), $user->getId()); $this->assertTrue($user2 === $user3); - + $address2 = $this->_em->find(get_class($address), $address->getId()); $this->assertTrue($address2 !== $address); $address3 = $this->_em->find(get_class($address), $address->getId()); $this->assertTrue($address2 === $address3); - + $this->assertTrue($user2->getAddress() === $address2); // !!! } - + public function testSingleValuedAssociationIdentityMapBehaviorWithRefresh() { $address = new CmsAddress; $address->country = 'de'; $address->zip = '12345'; $address->city = 'Berlin'; - + $user1 = new CmsUser; $user1->status = 'dev'; $user1->username = 'romanb'; @@ -71,27 +71,27 @@ class IdentityMapTest extends \Doctrine\Tests\OrmFunctionalTestCase $user2->status = 'dev'; $user2->username = 'gblanco'; $user2->name = 'Guilherme Blanco'; - + $address->setUser($user1); - + $this->_em->persist($address); $this->_em->persist($user1); $this->_em->persist($user2); $this->_em->flush(); - + $this->assertSame($user1, $address->user); - + //external update to CmsAddress $this->_em->getConnection()->executeUpdate('update cms_addresses set user_id = ?', array($user2->getId())); - + // But we want to have this external change! - // Solution 1: refresh(), broken atm! + // Solution 1: refresh(), broken atm! $this->_em->refresh($address); - + // Now the association should be "correct", referencing $user2 $this->assertSame($user2, $address->user); $this->assertSame($user2->address, $address); // check back reference also - + // Attention! refreshes can result in broken bidirectional associations! this is currently expected! // $user1 still points to $address! $this->assertSame($user1->address, $address); @@ -103,7 +103,7 @@ class IdentityMapTest extends \Doctrine\Tests\OrmFunctionalTestCase $address->country = 'de'; $address->zip = '12345'; $address->city = 'Berlin'; - + $user1 = new CmsUser; $user1->status = 'dev'; $user1->username = 'romanb'; @@ -113,47 +113,47 @@ class IdentityMapTest extends \Doctrine\Tests\OrmFunctionalTestCase $user2->status = 'dev'; $user2->username = 'gblanco'; $user2->name = 'Guilherme Blanco'; - + $address->setUser($user1); - + $this->_em->persist($address); $this->_em->persist($user1); $this->_em->persist($user2); $this->_em->flush(); - - + + $this->assertSame($user1, $address->user); - + //external update to CmsAddress $this->_em->getConnection()->executeUpdate('update cms_addresses set user_id = ?', array($user2->getId())); - + //select $q = $this->_em->createQuery('select a, u from Doctrine\Tests\Models\CMS\CmsAddress a join a.user u'); $address2 = $q->getSingleResult(); - + $this->assertSame($address, $address2); - + // Should still be $user1 $this->assertSame($user1, $address2->user); $this->assertTrue($user2->address === null); - + // But we want to have this external change! // Solution 2: Alternatively, a refresh query should work $q = $this->_em->createQuery('select a, u from Doctrine\Tests\Models\CMS\CmsAddress a join a.user u'); $q->setHint(Query::HINT_REFRESH, true); $address3 = $q->getSingleResult(); - + $this->assertSame($address, $address3); // should still be the same, always from identity map - + // Now the association should be "correct", referencing $user2 $this->assertSame($user2, $address2->user); $this->assertSame($user2->address, $address2); // check back reference also - + // Attention! refreshes can result in broken bidirectional associations! this is currently expected! // $user1 still points to $address2! $this->assertSame($user1->address, $address2); } - + public function testCollectionValuedAssociationIdentityMapBehaviorWithRefreshQuery() { $user = new CmsUser; @@ -163,35 +163,35 @@ class IdentityMapTest extends \Doctrine\Tests\OrmFunctionalTestCase $phone1 = new CmsPhonenumber; $phone1->phonenumber = 123; - + $phone2 = new CmsPhonenumber; $phone2->phonenumber = 234; - + $phone3 = new CmsPhonenumber; $phone3->phonenumber = 345; - + $user->addPhonenumber($phone1); $user->addPhonenumber($phone2); $user->addPhonenumber($phone3); - + $this->_em->persist($user); // cascaded to phone numbers $this->_em->flush(); - + $this->assertEquals(3, count($user->getPhonenumbers())); $this->assertFalse($user->getPhonenumbers()->isDirty()); - + //external update to CmsAddress $this->_em->getConnection()->executeUpdate('insert into cms_phonenumbers (phonenumber, user_id) VALUES (?,?)', array(999, $user->getId())); - + //select $q = $this->_em->createQuery('select u, p from Doctrine\Tests\Models\CMS\CmsUser u join u.phonenumbers p'); $user2 = $q->getSingleResult(); - + $this->assertSame($user, $user2); - + // Should still be the same 3 phonenumbers $this->assertEquals(3, count($user2->getPhonenumbers())); - + // But we want to have this external change! // Solution 1: refresh(). //$this->_em->refresh($user2); broken atm! @@ -199,13 +199,13 @@ class IdentityMapTest extends \Doctrine\Tests\OrmFunctionalTestCase $q = $this->_em->createQuery('select u, p from Doctrine\Tests\Models\CMS\CmsUser u join u.phonenumbers p'); $q->setHint(Query::HINT_REFRESH, true); $user3 = $q->getSingleResult(); - + $this->assertSame($user, $user3); // should still be the same, always from identity map - + // Now the collection should be refreshed with correct count $this->assertEquals(4, count($user3->getPhonenumbers())); } - + public function testCollectionValuedAssociationIdentityMapBehaviorWithRefresh() { $user = new CmsUser; @@ -215,44 +215,44 @@ class IdentityMapTest extends \Doctrine\Tests\OrmFunctionalTestCase $phone1 = new CmsPhonenumber; $phone1->phonenumber = 123; - + $phone2 = new CmsPhonenumber; $phone2->phonenumber = 234; - + $phone3 = new CmsPhonenumber; $phone3->phonenumber = 345; - + $user->addPhonenumber($phone1); $user->addPhonenumber($phone2); $user->addPhonenumber($phone3); - + $this->_em->persist($user); // cascaded to phone numbers $this->_em->flush(); - + $this->assertEquals(3, count($user->getPhonenumbers())); - + //external update to CmsAddress $this->_em->getConnection()->executeUpdate('insert into cms_phonenumbers (phonenumber, user_id) VALUES (?,?)', array(999, $user->getId())); - + //select $q = $this->_em->createQuery('select u, p from Doctrine\Tests\Models\CMS\CmsUser u join u.phonenumbers p'); $user2 = $q->getSingleResult(); - + $this->assertSame($user, $user2); - + // Should still be the same 3 phonenumbers $this->assertEquals(3, count($user2->getPhonenumbers())); - + // But we want to have this external change! // Solution 1: refresh(). $this->_em->refresh($user2); - + $this->assertSame($user, $user2); // should still be the same, always from identity map - + // Now the collection should be refreshed with correct count $this->assertEquals(4, count($user2->getPhonenumbers())); } - + public function testReusedSplObjectHashDoesNotConfuseUnitOfWork() { $hash1 = $this->subRoutine($this->_em); @@ -261,7 +261,7 @@ class IdentityMapTest extends \Doctrine\Tests\OrmFunctionalTestCase // be garbage collected and thus the object hash is not reused. // This is not a memory leak! gc_collect_cycles(); - + $user1 = new CmsUser; $user1->status = 'dev'; $user1->username = 'jwage'; @@ -271,7 +271,7 @@ class IdentityMapTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->persist($user1); $this->_em->flush(); } - + private function subRoutine($em) { $user = new CmsUser; $user->status = 'dev'; @@ -281,7 +281,7 @@ class IdentityMapTest extends \Doctrine\Tests\OrmFunctionalTestCase $em->flush(); $em->remove($user); $em->flush(); - + return spl_object_hash($user); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php b/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php index 8015f341f..230f562c6 100644 --- a/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php @@ -19,30 +19,30 @@ class LifecycleCallbackTest extends \Doctrine\Tests\OrmFunctionalTestCase // Swallow all exceptions. We do not test the schema tool here. } } - + public function testPreSavePostSaveCallbacksAreInvoked() - { + { $entity = new LifecycleCallbackTestEntity; $entity->value = 'hello'; $this->_em->persist($entity); $this->_em->flush(); - + $this->assertTrue($entity->prePersistCallbackInvoked); $this->assertTrue($entity->postPersistCallbackInvoked); - + $this->_em->clear(); - + $query = $this->_em->createQuery("select e from Doctrine\Tests\ORM\Functional\LifecycleCallbackTestEntity e"); $result = $query->getResult(); $this->assertTrue($result[0]->postLoadCallbackInvoked); - + $result[0]->value = 'hello again'; - + $this->_em->flush(); - + $this->assertEquals('changed from preUpdate callback!', $result[0]->value); } - + public function testPreFlushCallbacksAreInvoked() { $entity = new LifecycleCallbackTestEntity; @@ -73,14 +73,14 @@ class LifecycleCallbackTest extends \Doctrine\Tests\OrmFunctionalTestCase $user->setValue('value'); $this->_em->persist($user); $this->_em->flush(); - + $user->setName('Alice'); $this->_em->flush(); // Triggers preUpdate - + $this->_em->clear(); - + $user2 = $this->_em->find(get_class($user), $user->getId()); - + $this->assertEquals('Alice', $user2->getName()); $this->assertEquals('Hello World', $user2->getValue()); } @@ -132,25 +132,25 @@ class LifecycleCallbackTest extends \Doctrine\Tests\OrmFunctionalTestCase public function testCascadedEntitiesCallsPrePersist() { //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger); - + $e1 = new LifecycleCallbackTestEntity; $e2 = new LifecycleCallbackTestEntity; $c = new LifecycleCallbackCascader(); $this->_em->persist($c); - + $c->entities[] = $e1; $c->entities[] = $e2; $e1->cascader = $c; $e2->cascader = $c; - + //$this->_em->persist($c); $this->_em->flush(); $this->assertTrue($e1->prePersistCallbackInvoked); $this->assertTrue($e2->prePersistCallbackInvoked); } - + public function testLifecycleCallbacksGetInherited() { $childMeta = $this->_em->getClassMetadata(__NAMESPACE__ . '\LifecycleCallbackChildEntity'); @@ -212,7 +212,7 @@ class LifecycleCallbackTestEntity public $prePersistCallbackInvoked = false; public $postPersistCallbackInvoked = false; public $postLoadCallbackInvoked = false; - + public $preFlushCallbackInvoked = false; /** @@ -234,26 +234,26 @@ class LifecycleCallbackTestEntity public function getId() { return $this->id; } - + public function getValue() { return $this->value; } - + /** @PrePersist */ public function doStuffOnPrePersist() { $this->prePersistCallbackInvoked = true; } - + /** @PostPersist */ public function doStuffOnPostPersist() { $this->postPersistCallbackInvoked = true; } - + /** @PostLoad */ public function doStuffOnPostLoad() { $this->postLoadCallbackInvoked = true; } - + /** @PreUpdate */ public function doStuffOnPreUpdate() { $this->value = 'changed from preUpdate callback!'; @@ -292,7 +292,7 @@ class LifecycleCallbackCascader class LifecycleCallbackParentEntity { /** @PrePersist */ function doStuff() { - + } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Locking/GearmanLockTest.php b/tests/Doctrine/Tests/ORM/Functional/Locking/GearmanLockTest.php index a597cc207..a67a44d8f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Locking/GearmanLockTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Locking/GearmanLockTest.php @@ -51,7 +51,7 @@ class GearmanLockTest extends \Doctrine\Tests\OrmFunctionalTestCase { $this->asyncFindWithLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_WRITE); $this->asyncFindWithLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_WRITE); - + $this->assertLockWorked(); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php b/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php index b3d9e9b08..e2341a19e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php @@ -52,7 +52,7 @@ class OptimisticTest extends \Doctrine\Tests\OrmFunctionalTestCase $test = $q->getSingleResult(); // Manually update/increment the version so we can try and save the same - // $test and make sure the exception is thrown saying the record was + // $test and make sure the exception is thrown saying the record was // changed or updated since you read it $this->_conn->executeQuery('UPDATE optimistic_joined_parent SET version = ? WHERE id = ?', array(2, $test->id)); @@ -87,7 +87,7 @@ class OptimisticTest extends \Doctrine\Tests\OrmFunctionalTestCase $test = $q->getSingleResult(); // Manually update/increment the version so we can try and save the same - // $test and make sure the exception is thrown saying the record was + // $test and make sure the exception is thrown saying the record was // changed or updated since you read it $this->_conn->executeQuery('UPDATE optimistic_joined_parent SET version = ? WHERE id = ?', array(2, $test->id)); @@ -137,7 +137,7 @@ class OptimisticTest extends \Doctrine\Tests\OrmFunctionalTestCase $test = $q->getSingleResult(); // Manually update/increment the version so we can try and save the same - // $test and make sure the exception is thrown saying the record was + // $test and make sure the exception is thrown saying the record was // changed or updated since you read it $this->_conn->executeQuery('UPDATE optimistic_standard SET version = ? WHERE id = ?', array(2, $test->id)); @@ -249,7 +249,7 @@ class OptimisticStandard * @Version @Column(type="integer") */ private $version; - + function getVersion() {return $this->version;} } diff --git a/tests/Doctrine/Tests/ORM/Functional/ManyToManyBasicAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/ManyToManyBasicAssociationTest.php index cbdb44104..1e1df9d51 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ManyToManyBasicAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ManyToManyBasicAssociationTest.php @@ -11,7 +11,7 @@ require_once __DIR__ . '/../../TestInit.php'; /** * Basic many-to-many association tests. * ("Working with associations") - * + * * @author robo */ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCase @@ -68,55 +68,55 @@ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCa $query = $this->_em->createQuery("select u, g from Doctrine\Tests\Models\CMS\CmsUser u join u.groups g"); $this->assertEquals(0, count($query->getResult())); } - + public function testManyToManyAddRemove() { $user = $this->addCmsUserGblancoWithGroups(2); $this->_em->clear(); - + $uRep = $this->_em->getRepository(get_class($user)); - + // Get user $user = $uRep->findOneById($user->getId()); $this->assertNotNull($user, "Has to return exactly one entry."); $this->assertFalse($user->getGroups()->isInitialized()); - + // Check groups $this->assertEquals(2, $user->getGroups()->count()); - + $this->assertTrue($user->getGroups()->isInitialized()); - + // Remove first group unset($user->groups[0]); //$user->getGroups()->remove(0); - + $this->_em->flush(); $this->_em->clear(); - + // Reload same user $user2 = $uRep->findOneById($user->getId()); - + // Check groups - $this->assertEquals(1, $user2->getGroups()->count()); + $this->assertEquals(1, $user2->getGroups()->count()); } - + public function testManyToManyInverseSideIgnored() { $user = $this->addCmsUserGblancoWithGroups(0); - + $group = new CmsGroup; $group->name = 'Humans'; - + // modify directly, addUser() would also (properly) set the owning side $group->users[] = $user; - + $this->_em->persist($user); $this->_em->persist($group); $this->_em->flush(); $this->_em->clear(); - + // Association should not exist $user2 = $this->_em->find(get_class($user), $user->getId()); @@ -152,11 +152,11 @@ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCa $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $user->groups); $this->assertTrue($user->groups->isDirty()); - + $this->assertEquals($groupCount, count($user->groups), "There should be 10 groups in the collection."); - + $this->_em->flush(); - + $this->assertGblancoGroupCountIs($groupCount); } @@ -197,7 +197,7 @@ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCa $this->assertFalse($freshUser->groups->isInitialized(), "CmsUser::groups Collection has to be uninitialized for this test."); $this->assertEquals(3, count($freshUser->getGroups())); $this->assertEquals(3, count($freshUser->getGroups()->getSnapshot()), "Snapshot of CmsUser::groups should contain 3 entries."); - + $this->_em->clear(); $freshUser = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $user->getId()); @@ -257,7 +257,7 @@ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCa $group = new CmsGroup(); $group->name = "Developers0"; $this->_em->persist($group); - + $this->_em->flush(); $this->_em->clear(); @@ -268,7 +268,7 @@ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCa $this->assertInternalType('array', $newUser->groups->getMapping()); $newUser->addGroup($group); - + $this->_em->flush(); $this->_em->clear(); @@ -342,7 +342,7 @@ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCa $this->assertEquals('Developers_New1', $user->groups[0]->name); $this->assertEquals('Developers_New2', $user->groups[1]->name); } - + /** * @group DDC-733 */ @@ -350,14 +350,14 @@ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCa { $user = $this->addCmsUserGblancoWithGroups(2); $this->_em->clear(); - + $user = $this->_em->find(get_class($user), $user->id); - + $this->assertFalse($user->groups->isInitialized(), "Pre-condition: lazy collection"); $this->_em->getUnitOfWork()->initializeObject($user->groups); $this->assertTrue($user->groups->isInitialized(), "Collection should be initialized after calling UnitOfWork::initializeObject()"); } - + /** * @group DDC-1189 * @group DDC-956 @@ -365,15 +365,15 @@ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCa public function testClearBeforeLazyLoad() { $user = $this->addCmsUserGblancoWithGroups(4); - + $this->_em->clear(); - + $user = $this->_em->find(get_class($user), $user->id); - $user->groups->clear(); + $user->groups->clear(); $this->assertEquals(0, count($user->groups)); - + $this->_em->flush(); - + $user = $this->_em->find(get_class($user), $user->id); $this->assertEquals(0, count($user->groups)); } diff --git a/tests/Doctrine/Tests/ORM/Functional/ManyToManyBidirectionalAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/ManyToManyBidirectionalAssociationTest.php index f8228d7ad..cfe9f1e83 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ManyToManyBidirectionalAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ManyToManyBidirectionalAssociationTest.php @@ -43,7 +43,7 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati $this->firstProduct->addCategory($this->secondCategory); $this->_em->persist($this->firstProduct); $this->_em->flush(); - + $this->assertForeignKeysContain($this->firstProduct->getId(), $this->firstCategory->getId()); $this->assertForeignKeysContain($this->firstProduct->getId(), $this->secondCategory->getId()); } @@ -59,10 +59,10 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati $this->assertForeignKeysNotContain($this->firstProduct->getId(), $this->firstCategory->getId()); $this->assertForeignKeysContain($this->firstProduct->getId(), $this->secondCategory->getId()); - + $this->firstProduct->getCategories()->remove(1); $this->_em->flush(); - + $this->assertForeignKeysNotContain($this->firstProduct->getId(), $this->secondCategory->getId()); } @@ -90,7 +90,7 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati $this->secondProduct->addCategory($this->secondCategory); $this->_em->persist($this->firstProduct); $this->_em->persist($this->secondProduct); - + $this->_em->flush(); $this->_em->clear(); } @@ -110,7 +110,7 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati return $result; } - + protected function _findCategories() { $query = $this->_em->createQuery('SELECT c, p FROM Doctrine\Tests\Models\ECommerce\ECommerceCategory c LEFT JOIN c.products p ORDER BY c.id, p.id'); @@ -123,26 +123,26 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati $prods2 = $result[1]->getProducts(); $this->assertTrue($prods1->isInitialized()); $this->assertTrue($prods2->isInitialized()); - + $this->assertFalse($prods1[0]->getCategories()->isInitialized()); $this->assertFalse($prods2[0]->getCategories()->isInitialized()); return $result; } - + public function assertLazyLoadFromInverseSide($products) { list ($firstProduct, $secondProduct) = $products; $firstProductCategories = $firstProduct->getCategories(); $secondProductCategories = $secondProduct->getCategories(); - + $this->assertEquals(2, count($firstProductCategories)); $this->assertEquals(2, count($secondProductCategories)); - + $this->assertTrue($firstProductCategories[0] === $secondProductCategories[0]); $this->assertTrue($firstProductCategories[1] === $secondProductCategories[1]); - + $firstCategoryProducts = $firstProductCategories[0]->getProducts(); $secondCategoryProducts = $firstProductCategories[1]->getProducts(); @@ -150,7 +150,7 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati $this->assertFalse($secondCategoryProducts->isInitialized()); $this->assertEquals(0, $firstCategoryProducts->unwrap()->count()); $this->assertEquals(0, $secondCategoryProducts->unwrap()->count()); - + $this->assertEquals(2, count($firstCategoryProducts)); // lazy-load $this->assertTrue($firstCategoryProducts->isInitialized()); $this->assertFalse($secondCategoryProducts->isInitialized()); @@ -161,7 +161,7 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati $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); } @@ -171,13 +171,13 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati $firstCategoryProducts = $firstCategory->getProducts(); $secondCategoryProducts = $secondCategory->getProducts(); - + $this->assertEquals(2, count($firstCategoryProducts)); $this->assertEquals(2, count($secondCategoryProducts)); - + $this->assertTrue($firstCategoryProducts[0] === $secondCategoryProducts[0]); $this->assertTrue($firstCategoryProducts[1] === $secondCategoryProducts[1]); - + $firstProductCategories = $firstCategoryProducts[0]->getCategories(); $secondProductCategories = $firstCategoryProducts[1]->getCategories(); @@ -185,7 +185,7 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati $this->assertFalse($secondProductCategories->isInitialized()); $this->assertEquals(0, $firstProductCategories->unwrap()->count()); $this->assertEquals(0, $secondProductCategories->unwrap()->count()); - + $this->assertEquals(2, count($firstProductCategories)); // lazy-load $this->assertTrue($firstProductCategories->isInitialized()); $this->assertFalse($secondProductCategories->isInitialized()); @@ -196,7 +196,7 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati $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 2993825fa..40518e086 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ManyToManySelfReferentialAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ManyToManySelfReferentialAssociationTest.php @@ -41,7 +41,7 @@ class ManyToManySelfReferentialAssociationTest extends AbstractManyToManyAssocia $this->firstProduct->addRelated($this->secondRelated); $this->_em->persist($this->firstProduct); $this->_em->flush(); - + $this->assertForeignKeysContain($this->firstProduct->getId(), $this->firstRelated->getId()); $this->assertForeignKeysContain($this->firstProduct->getId(), @@ -67,7 +67,7 @@ class ManyToManySelfReferentialAssociationTest extends AbstractManyToManyAssocia { $this->_createLoadingFixture(); $products = $this->_findProducts(); - $this->assertLoadingOfOwningSide($products); + $this->assertLoadingOfOwningSide($products); } public function testLazyLoadsOwningSide() @@ -79,7 +79,7 @@ class ManyToManySelfReferentialAssociationTest extends AbstractManyToManyAssocia $query = $this->_em->createQuery('SELECT p FROM Doctrine\Tests\Models\ECommerce\ECommerceProduct p'); $products = $query->getResult(); - $this->assertLoadingOfOwningSide($products); + $this->assertLoadingOfOwningSide($products); } public function assertLoadingOfOwningSide($products) @@ -87,11 +87,11 @@ class ManyToManySelfReferentialAssociationTest extends AbstractManyToManyAssocia list ($firstProduct, $secondProduct) = $products; $this->assertEquals(2, count($firstProduct->getRelated())); $this->assertEquals(2, count($secondProduct->getRelated())); - - $categories = $firstProduct->getRelated(); + + $categories = $firstProduct->getRelated(); $firstRelatedBy = $categories[0]->getRelated(); $secondRelatedBy = $categories[1]->getRelated(); - + $this->assertEquals(2, count($firstRelatedBy)); $this->assertEquals(2, count($secondRelatedBy)); @@ -99,7 +99,7 @@ class ManyToManySelfReferentialAssociationTest extends AbstractManyToManyAssocia $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); } @@ -111,7 +111,7 @@ class ManyToManySelfReferentialAssociationTest extends AbstractManyToManyAssocia $this->secondProduct->addRelated($this->secondRelated); $this->_em->persist($this->firstProduct); $this->_em->persist($this->secondProduct); - + $this->_em->flush(); $this->_em->clear(); } diff --git a/tests/Doctrine/Tests/ORM/Functional/ManyToManyUnidirectionalAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/ManyToManyUnidirectionalAssociationTest.php index 7de55e4f0..ba83d5315 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ManyToManyUnidirectionalAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ManyToManyUnidirectionalAssociationTest.php @@ -41,7 +41,7 @@ class ManyToManyUnidirectionalAssociationTest extends AbstractManyToManyAssociat $this->firstCart->addProduct($this->secondProduct); $this->_em->persist($this->firstCart); $this->_em->flush(); - + $this->assertForeignKeysContain($this->firstCart->getId(), $this->firstProduct->getId()); $this->assertForeignKeysContain($this->firstCart->getId(), $this->secondProduct->getId()); } @@ -68,14 +68,14 @@ class ManyToManyUnidirectionalAssociationTest extends AbstractManyToManyAssociat $firstCart = $result[0]; $products = $firstCart->getProducts(); $secondCart = $result[1]; - + $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()); } - + public function testLazyLoadsCollection() { $this->_createFixture(); @@ -87,7 +87,7 @@ class ManyToManyUnidirectionalAssociationTest extends AbstractManyToManyAssociat $firstCart = $result[0]; $products = $firstCart->getProducts(); $secondCart = $result[1]; - + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $products[0]); $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $products[1]); $this->assertCollectionEquals($products, $secondCart->getProducts()); @@ -101,7 +101,7 @@ class ManyToManyUnidirectionalAssociationTest extends AbstractManyToManyAssociat $this->secondCart->addProduct($this->secondProduct); $this->_em->persist($this->firstCart); $this->_em->persist($this->secondCart); - + $this->_em->flush(); $this->_em->clear(); } diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToManyBidirectionalAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToManyBidirectionalAssociationTest.php index e39e10b3e..a9258dacf 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToManyBidirectionalAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToManyBidirectionalAssociationTest.php @@ -34,7 +34,7 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $this->product->addFeature($this->secondFeature); $this->_em->persist($this->product); $this->_em->flush(); - + $this->assertFeatureForeignKeyIs($this->product->getId(), $this->firstFeature); $this->assertFeatureForeignKeyIs($this->product->getId(), $this->secondFeature); } @@ -51,7 +51,7 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $this->product->brokenAddFeature($this->firstFeature); $this->_em->persist($this->product); $this->_em->flush(); - + $this->assertFeatureForeignKeyIs(null, $this->firstFeature); } @@ -74,9 +74,9 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $query = $this->_em->createQuery('select p, f from Doctrine\Tests\Models\ECommerce\ECommerceProduct p join p.features f'); $result = $query->getResult(); $product = $result[0]; - + $features = $product->getFeatures(); - + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceFeature', $features[0]); $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $features[0]->getProduct()); $this->assertSame($product, $features[0]->getProduct()); @@ -86,7 +86,7 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $features[1]->getProduct()); $this->assertEquals('Annotations examples', $features[1]->getDescription()); } - + public function testLazyLoadsObjectsOnTheOwningSide() { $this->_createFixture(); @@ -95,7 +95,7 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $result = $query->getResult(); $product = $result[0]; $features = $product->getFeatures(); - + $this->assertFalse($features->isInitialized()); $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceFeature', $features[0]); $this->assertTrue($features->isInitialized()); @@ -112,7 +112,7 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $query = $this->_em->createQuery('select f from Doctrine\Tests\Models\ECommerce\ECommerceFeature f'); $features = $query->getResult(); - + $product = $features[0]->getProduct(); $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $product); $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $product); @@ -120,7 +120,7 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $this->assertSame('Doctrine Cookbook', $product->getName()); $this->assertTrue($product->__isInitialized__); } - + public function testLazyLoadsObjectsOnTheInverseSide2() { //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger); @@ -128,22 +128,22 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $query = $this->_em->createQuery('select f,p from Doctrine\Tests\Models\ECommerce\ECommerceFeature f join f.product p'); $features = $query->getResult(); - + $product = $features[0]->getProduct(); $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()); - + // This would trigger lazy-load //$this->assertEquals(2, $product->getFeatures()->count()); //$this->assertTrue($product->getFeatures()->contains($features[0])); //$this->assertTrue($product->getFeatures()->contains($features[1])); - + //$this->_em->getConnection()->getConfiguration()->setSQLLogger(null); } - + public function testJoinFromOwningSide() { $query = $this->_em->createQuery('select f,p from Doctrine\Tests\Models\ECommerce\ECommerceFeature f join f.product p'); @@ -156,7 +156,7 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $this->product->addFeature($this->firstFeature); $this->product->addFeature($this->secondFeature); $this->_em->persist($this->product); - + $this->_em->flush(); $this->_em->clear(); } diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToManySelfReferentialAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToManySelfReferentialAssociationTest.php index e37497658..d16217157 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToManySelfReferentialAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToManySelfReferentialAssociationTest.php @@ -33,9 +33,9 @@ class OneToManySelfReferentialAssociationTest extends \Doctrine\Tests\OrmFunctio $this->parent->addChild($this->firstChild); $this->parent->addChild($this->secondChild); $this->_em->persist($this->parent); - + $this->_em->flush(); - + $this->assertForeignKeyIs($this->parent->getId(), $this->firstChild); $this->assertForeignKeyIs($this->parent->getId(), $this->secondChild); } @@ -52,7 +52,7 @@ class OneToManySelfReferentialAssociationTest extends \Doctrine\Tests\OrmFunctio $this->parent->brokenAddChild($this->firstChild); $this->_em->persist($this->parent); $this->_em->flush(); - + $this->assertForeignKeyIs(null, $this->firstChild); } @@ -78,7 +78,7 @@ class OneToManySelfReferentialAssociationTest extends \Doctrine\Tests\OrmFunctio $this->assertEquals(1, count($result)); $parent = $result[0]; $children = $parent->getChildren(); - + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $children[0]); $this->assertSame($parent, $children[0]->getParent()); $this->assertEquals(' books', strstr($children[0]->getName(), ' books')); @@ -97,7 +97,7 @@ class OneToManySelfReferentialAssociationTest extends \Doctrine\Tests\OrmFunctio $result = $query->getResult(); $parent = $result[0]; $children = $parent->getChildren(); - + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $children[0]); $this->assertSame($parent, $children[0]->getParent()); $this->assertEquals(' books', strstr($children[0]->getName(), ' books')); @@ -111,7 +111,7 @@ class OneToManySelfReferentialAssociationTest extends \Doctrine\Tests\OrmFunctio $this->parent->addChild($this->firstChild); $this->parent->addChild($this->secondChild); $this->_em->persist($this->parent); - + $this->_em->flush(); $this->_em->clear(); } diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneBidirectionalAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneBidirectionalAssociationTest.php index 75be67e77..ced524c45 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneBidirectionalAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneBidirectionalAssociationTest.php @@ -31,7 +31,7 @@ class OneToOneBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctional $this->customer->setCart($this->cart); $this->_em->persist($this->customer); $this->_em->flush(); - + $this->assertCartForeignKeyIs($this->customer->getId()); } @@ -39,7 +39,7 @@ class OneToOneBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctional $this->customer->brokenSetCart($this->cart); $this->_em->persist($this->customer); $this->_em->flush(); - + $this->assertCartForeignKeyIs(null); } @@ -61,11 +61,11 @@ class OneToOneBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctional $query = $this->_em->createQuery('select c, ca from Doctrine\Tests\Models\ECommerce\ECommerceCustomer c join c.cart ca'); $result = $query->getResult(); $customer = $result[0]; - + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCart', $customer->getCart()); $this->assertEquals('paypal', $customer->getCart()->getPayment()); } - + public function testLazyLoadsObjectsOnTheOwningSide() { $this->_createFixture(); $metadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\ECommerce\ECommerceCart'); @@ -74,7 +74,7 @@ class OneToOneBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctional $query = $this->_em->createQuery('select c from Doctrine\Tests\Models\ECommerce\ECommerceCart c'); $result = $query->getResult(); $cart = $result[0]; - + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCustomer', $cart->getCustomer()); $this->assertEquals('Giorgio', $cart->getCustomer()->getName()); } @@ -88,44 +88,44 @@ class OneToOneBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctional $query = $this->_em->createQuery('select c from Doctrine\Tests\Models\ECommerce\ECommerceCustomer c'); $result = $query->getResult(); $customer = $result[0]; - + $this->assertNull($customer->getMentor()); $this->assertInstanceOF('Doctrine\Tests\Models\ECommerce\ECommerceCart', $customer->getCart()); $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $customer->getCart()); $this->assertEquals('paypal', $customer->getCart()->getPayment()); } - + public function testUpdateWithProxyObject() - { + { $cust = new ECommerceCustomer; $cust->setName('Roman'); $cart = new ECommerceCart; $cart->setPayment('CARD'); $cust->setCart($cart); - + $this->_em->persist($cust); $this->_em->flush(); $this->_em->clear(); - + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCart', $cust->getCart()); $this->assertEquals('Roman', $cust->getName()); $this->assertSame($cust, $cart->getCustomer()); - + $query = $this->_em->createQuery('select ca from Doctrine\Tests\Models\ECommerce\ECommerceCart ca where ca.id =?1'); $query->setParameter(1, $cart->getId()); - + $cart2 = $query->getSingleResult(); - + $cart2->setPayment('CHEQUE'); $this->_em->flush(); $this->_em->clear(); - + $query2 = $this->_em->createQuery('select ca, c from Doctrine\Tests\Models\ECommerce\ECommerceCart ca left join ca.customer c where ca.id =?1'); $query2->setParameter(1, $cart->getId()); - + $cart3 = $query2->getSingleResult(); - + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCustomer', $cart3->getCustomer()); $this->assertEquals('Roman', $cart3->getCustomer()->getName()); } @@ -137,9 +137,9 @@ class OneToOneBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctional $cart = new ECommerceCart; $cart->setPayment('paypal'); $customer->setCart($cart); - + $this->_em->persist($customer); - + $this->_em->flush(); $this->_em->clear(); } diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php index 8257176ab..b094054eb 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php @@ -30,7 +30,7 @@ class OneToOneEagerLoadingTest extends \Doctrine\Tests\OrmFunctionalTestCase $train = new Train(new TrainOwner("Alexander")); $driver = new TrainDriver("Benjamin"); $waggon = new Waggon(); - + $train->setDriver($driver); $train->addWaggon($waggon); diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneOrphanRemovalTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneOrphanRemovalTest.php index c9bd72fcf..6b3d0a2f0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneOrphanRemovalTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneOrphanRemovalTest.php @@ -17,78 +17,78 @@ class OneToOneOrphanRemovalTest extends \Doctrine\Tests\OrmFunctionalTestCase protected function setUp() { $this->useModelSet('cms'); - + parent::setUp(); } - + public function testOrphanRemoval() { $user = new CmsUser; $user->status = 'dev'; $user->username = 'romanb'; $user->name = 'Roman B.'; - + $address = new CmsAddress; $address->country = 'de'; $address->zip = 1234; $address->city = 'Berlin'; - + $user->setAddress($address); - + $this->_em->persist($user); $this->_em->flush(); - + $userId = $user->getId(); - + $this->_em->clear(); - + $userProxy = $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsUser', $userId); - + $this->_em->remove($userProxy); $this->_em->flush(); $this->_em->clear(); - + $query = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u'); $result = $query->getResult(); - + $this->assertEquals(0, count($result), 'CmsUser should be removed by EntityManager'); - + $query = $this->_em->createQuery('SELECT a FROM Doctrine\Tests\Models\CMS\CmsAddress a'); $result = $query->getResult(); - + $this->assertEquals(0, count($result), 'CmsAddress should be removed by orphanRemoval'); } - + public function testOrphanRemovalWhenUnlink() { $user = new CmsUser; $user->status = 'dev'; $user->username = 'beberlei'; $user->name = 'Bejamin Eberlei'; - + $email = new CmsEmail; $email->email = 'beberlei@domain.com'; - + $user->setEmail($email); - + $this->_em->persist($user); $this->_em->flush(); - + $userId = $user->getId(); - + $this->_em->clear(); - + $user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $userId); - + $user->setEmail(null); - + $this->_em->persist($user); $this->_em->flush(); $this->_em->clear(); - + $query = $this->_em->createQuery('SELECT e FROM Doctrine\Tests\Models\CMS\CmsEmail e'); $result = $query->getResult(); - + $this->assertEquals(0, count($result), 'CmsEmail should be removed by orphanRemoval'); } } \ No newline at end of file diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneSelfReferentialAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneSelfReferentialAssociationTest.php index bcd41dcaf..326e7aec1 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneSelfReferentialAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneSelfReferentialAssociationTest.php @@ -10,7 +10,7 @@ require_once __DIR__ . '/../../TestInit.php'; /** * Tests a self referential one-to-one association mapping (without inheritance). - * Relation is defined as the mentor that a customer choose. The mentor could + * Relation is defined as the mentor that a customer choose. The mentor could * help only one other customer, while a customer can choose only one mentor * for receiving support. * Inverse side is not present. @@ -34,7 +34,7 @@ class OneToOneSelfReferentialAssociationTest extends \Doctrine\Tests\OrmFunction $this->customer->setMentor($this->mentor); $this->_em->persist($this->customer); $this->_em->flush(); - + $this->assertForeignKeyIs($this->mentor->getId()); } @@ -66,24 +66,24 @@ class OneToOneSelfReferentialAssociationTest extends \Doctrine\Tests\OrmFunction $customer = $result[0]; $this->assertLoadingOfAssociation($customer); } - + /** * @group mine * @return unknown_type */ public function testLazyLoadsAssociation() - { + { $this->_createFixture(); $metadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\ECommerce\ECommerceCustomer'); $metadata->associationMappings['mentor']['fetch'] = ClassMetadata::FETCH_LAZY; - + $query = $this->_em->createQuery("select c from Doctrine\Tests\Models\ECommerce\ECommerceCustomer c where c.name='Luke Skywalker'"); $result = $query->getResult(); $customer = $result[0]; $this->assertLoadingOfAssociation($customer); } - + public function testMultiSelfReference() { try { @@ -93,17 +93,17 @@ class OneToOneSelfReferentialAssociationTest extends \Doctrine\Tests\OrmFunction } catch (\Exception $e) { // Swallow all exceptions. We do not test the schema tool here. } - + $entity1 = new MultiSelfReference(); $this->_em->persist($entity1); $entity1->setOther1($entity2 = new MultiSelfReference); $entity1->setOther2($entity3 = new MultiSelfReference); $this->_em->flush(); - + $this->_em->clear(); - + $entity2 = $this->_em->find(get_class($entity1), $entity1->getId()); - + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\MultiSelfReference', $entity2->getOther1()); $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\MultiSelfReference', $entity2->getOther2()); $this->assertNull($entity2->getOther1()->getOther1()); @@ -130,9 +130,9 @@ class OneToOneSelfReferentialAssociationTest extends \Doctrine\Tests\OrmFunction $mentor = new ECommerceCustomer; $mentor->setName('Obi-wan Kenobi'); $customer->setMentor($mentor); - + $this->_em->persist($customer); - + $this->_em->flush(); $this->_em->clear(); @@ -156,7 +156,7 @@ class MultiSelfReference { * @JoinColumn(name="other2", referencedColumnName="id") */ private $other2; - + public function getId() {return $this->id;} public function setOther1($other1) {$this->other1 = $other1;} public function getOther1() {return $this->other1;} diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneUnidirectionalAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneUnidirectionalAssociationTest.php index ad4dd7404..1ffae6b13 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneUnidirectionalAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneUnidirectionalAssociationTest.php @@ -33,7 +33,7 @@ class OneToOneUnidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $this->product->setShipping($this->shipping); $this->_em->persist($this->product); $this->_em->flush(); - + $this->assertForeignKeyIs($this->shipping->getId()); } @@ -55,11 +55,11 @@ class OneToOneUnidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $query = $this->_em->createQuery('select p, s from Doctrine\Tests\Models\ECommerce\ECommerceProduct p left join p.shipping s'); $result = $query->getResult(); $product = $result[0]; - + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceShipping', $product->getShipping()); $this->assertEquals(1, $product->getShipping()->getDays()); } - + public function testLazyLoadsObjects() { $this->_createFixture(); $metadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\ECommerce\ECommerceProduct'); @@ -68,7 +68,7 @@ class OneToOneUnidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $query = $this->_em->createQuery('select p from Doctrine\Tests\Models\ECommerce\ECommerceProduct p'); $result = $query->getResult(); $product = $result[0]; - + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceShipping', $product->getShipping()); $this->assertEquals(1, $product->getShipping()->getDays()); } @@ -78,10 +78,10 @@ class OneToOneUnidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $query = $this->_em->createQuery('select p from Doctrine\Tests\Models\ECommerce\ECommerceProduct p'); $query->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true); - + $result = $query->getResult(); $product = $result[0]; - + $this->assertNull($product->getShipping()); } @@ -92,9 +92,9 @@ class OneToOneUnidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona $shipping = new ECommerceShipping; $shipping->setDays('1'); $product->setShipping($shipping); - + $this->_em->persist($product); - + $this->_em->flush(); $this->_em->clear(); } diff --git a/tests/Doctrine/Tests/ORM/Functional/OrderedCollectionTest.php b/tests/Doctrine/Tests/ORM/Functional/OrderedCollectionTest.php index f22c964b8..c2e131cb3 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OrderedCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OrderedCollectionTest.php @@ -87,7 +87,7 @@ class OrderedCollectionTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->persist($booking1); $this->_em->persist($booking2); - + $this->_em->flush(); $this->_em->clear(); diff --git a/tests/Doctrine/Tests/ORM/Functional/OrderedJoinedTableInheritanceCollectionTest.php b/tests/Doctrine/Tests/ORM/Functional/OrderedJoinedTableInheritanceCollectionTest.php index 0112a86bc..8c0d37b98 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OrderedJoinedTableInheritanceCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OrderedJoinedTableInheritanceCollectionTest.php @@ -61,7 +61,7 @@ class OrderedJoinedTableInheritanceCollectionTest extends \Doctrine\Tests\OrmFun $this->assertEquals(1, count($result)); $poofy = $result[0]; - + $this->assertEquals('Aari', $poofy->children[0]->getName()); $this->assertEquals('Zampa', $poofy->children[1]->getName()); } @@ -121,7 +121,7 @@ abstract class OJTIC_Pet */ class OJTIC_Cat extends OJTIC_Pet { - + } /** @@ -129,5 +129,5 @@ class OJTIC_Cat extends OJTIC_Pet */ class OJTIC_Dog extends OJTIC_Pet { - + } \ No newline at end of file diff --git a/tests/Doctrine/Tests/ORM/Functional/PostgreSQLIdentityStrategyTest.php b/tests/Doctrine/Tests/ORM/Functional/PostgreSQLIdentityStrategyTest.php index 74b6ed213..4ee7b7c9b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/PostgreSQLIdentityStrategyTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/PostgreSQLIdentityStrategyTest.php @@ -28,9 +28,9 @@ class PostgreSQLIdentityStrategyTest extends \Doctrine\Tests\OrmFunctionalTestCa // drop sequence manually due to dependency $this->_em->getConnection()->exec('DROP SEQUENCE postgresqlidentityentity_id_seq CASCADE'); } - + public function testPreSavePostSaveCallbacksAreInvoked() - { + { $entity = new PostgreSQLIdentityEntity(); $entity->setValue('hello'); $this->_em->persist($entity); diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php index 13a774b76..370761194 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php @@ -18,14 +18,14 @@ class QueryCacheTest extends \Doctrine\Tests\OrmFunctionalTestCase * @var \ReflectionProperty */ private $cacheDataReflection; - + protected function setUp() { $this->cacheDataReflection = new \ReflectionProperty("Doctrine\Common\Cache\ArrayCache", "data"); $this->cacheDataReflection->setAccessible(true); $this->useModelSet('cms'); parent::setUp(); } - + /** * @param ArrayCache $cache * @return integer @@ -34,7 +34,7 @@ class QueryCacheTest extends \Doctrine\Tests\OrmFunctionalTestCase { return sizeof($this->cacheDataReflection->getValue($cache)); } - + public function testQueryCache_DependsOnHints() { @@ -103,7 +103,7 @@ class QueryCacheTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->getConfiguration()->setQueryCacheImpl(new ArrayCache()); $query = $this->_em->createQuery('select ux from Doctrine\Tests\Models\CMS\CmsUser ux'); - + $cache = $this->getMock('Doctrine\Common\Cache\ArrayCache', array('doFetch', 'doSave', 'doGetStats')); $cache->expects($this->at(0)) ->method('doFetch') @@ -134,7 +134,7 @@ class QueryCacheTest extends \Doctrine\Tests\OrmFunctionalTestCase ->method('getSqlExecutor') ->will($this->returnValue($sqlExecMock)); - $cache = $this->getMock('Doctrine\Common\Cache\CacheProvider', + $cache = $this->getMock('Doctrine\Common\Cache\CacheProvider', array('doFetch', 'doContains', 'doSave', 'doDelete', 'doFlush', 'doGetStats')); $cache->expects($this->once()) ->method('doFetch') diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php index 9841dfeb7..d62c60a60 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php @@ -210,7 +210,7 @@ class QueryDqlFunctionTest extends \Doctrine\Tests\OrmFunctionalTestCase { $result = $this->_em->createQuery('SELECT m, m.salary+2500 AS add FROM Doctrine\Tests\Models\Company\CompanyManager m') ->getResult(); - + $this->assertEquals(4, count($result)); $this->assertEquals(102500, $result[0]['add']); $this->assertEquals(202500, $result[1]['add']); @@ -256,7 +256,7 @@ class QueryDqlFunctionTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertEquals(800000, $result[2]['op']); $this->assertEquals(1600000, $result[3]['op']); } - + public function testConcatFunction() { $arg = $this->_em->createQuery('SELECT CONCAT(m.name, m.department) AS namedep FROM Doctrine\Tests\Models\Company\CompanyManager m order by namedep desc') @@ -276,12 +276,12 @@ class QueryDqlFunctionTest extends \Doctrine\Tests\OrmFunctionalTestCase { $query = $this->_em->createQuery("SELECT DATE_DIFF(CURRENT_TIMESTAMP(), DATE_ADD(CURRENT_TIMESTAMP(), 10, 'day')) AS diff FROM Doctrine\Tests\Models\Company\CompanyManager m"); $arg = $query->getArrayResult(); - + $this->assertEquals(-10, $arg[0]['diff'], "Should be roughly -10 (or -9)", 1); - + $query = $this->_em->createQuery("SELECT DATE_DIFF(DATE_ADD(CURRENT_TIMESTAMP(), 10, 'day'), CURRENT_TIMESTAMP()) AS diff FROM Doctrine\Tests\Models\Company\CompanyManager m"); $arg = $query->getArrayResult(); - + $this->assertEquals(10, $arg[0]['diff'], "Should be roughly 10 (or 9)", 1); } diff --git a/tests/Doctrine/Tests/ORM/Functional/ResultCacheTest.php b/tests/Doctrine/Tests/ORM/Functional/ResultCacheTest.php index 3dcae4fab..2a5092188 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ResultCacheTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ResultCacheTest.php @@ -19,14 +19,14 @@ class ResultCacheTest extends \Doctrine\Tests\OrmFunctionalTestCase * @var \ReflectionProperty */ private $cacheDataReflection; - + protected function setUp() { $this->cacheDataReflection = new \ReflectionProperty("Doctrine\Common\Cache\ArrayCache", "data"); $this->cacheDataReflection->setAccessible(true); $this->useModelSet('cms'); parent::setUp(); } - + /** * @param ArrayCache $cache * @return integer @@ -49,7 +49,7 @@ class ResultCacheTest extends \Doctrine\Tests\OrmFunctionalTestCase $query = $this->_em->createQuery('select ux from Doctrine\Tests\Models\CMS\CmsUser ux'); $cache = new ArrayCache(); - + $query->setResultCacheDriver($cache)->setResultCacheId('my_cache_id'); $this->assertFalse($cache->contains('my_cache_id')); @@ -81,7 +81,7 @@ class ResultCacheTest extends \Doctrine\Tests\OrmFunctionalTestCase $query->setResultCacheId('testing_result_cache_id'); $this->assertFalse($cache->contains('testing_result_cache_id')); - + $users = $query->getResult(); $this->assertTrue($cache->contains('testing_result_cache_id')); @@ -140,7 +140,7 @@ class ResultCacheTest extends \Doctrine\Tests\OrmFunctionalTestCase $cache = new ArrayCache(); $query->setResultCacheDriver($cache)->useResultCache(true); - + $this->assertEquals(0, $this->getCacheSize($cache)); $query->getResult(); $this->assertEquals(1, $this->getCacheSize($cache)); @@ -234,7 +234,7 @@ class ResultCacheTest extends \Doctrine\Tests\OrmFunctionalTestCase $query2 = $this->_em->createQuery('select a from Doctrine\Tests\Models\CMS\CmsArticle a WHERE a.user = ?1'); $query2->setParameter(1, $user1); - + $query2->setResultCacheDriver($cache)->useResultCache(true); $articles = $query2->getResult(); diff --git a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DDC214Test.php b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DDC214Test.php index fb58bf07f..eae3d4b88 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DDC214Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DDC214Test.php @@ -84,7 +84,7 @@ class DDC214Test extends \Doctrine\Tests\OrmFunctionalTestCase $sql = $schemaDiff->toSql($this->_em->getConnection()->getDatabasePlatform()); $sql = array_filter($sql, function($sql) { return strpos($sql, 'DROP') === false; }); - + $this->assertEquals(0, count($sql), "SQL: " . implode(PHP_EOL, $sql)); } } \ No newline at end of file diff --git a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/MySqlSchemaToolTest.php b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/MySqlSchemaToolTest.php index be671bf3d..74d68ca60 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/MySqlSchemaToolTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/MySqlSchemaToolTest.php @@ -15,7 +15,7 @@ class MySqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->markTestSkipped('The ' . __CLASS__ .' requires the use of mysql.'); } } - + public function testGetCreateSchemaSql() { $classes = array( @@ -38,7 +38,7 @@ class MySqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertEquals(9, count($sql)); } - + public function testGetCreateSchemaSql2() { $classes = array( @@ -47,11 +47,11 @@ class MySqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase $tool = new SchemaTool($this->_em); $sql = $tool->getCreateSchemaSql($classes); - + $this->assertEquals(1, count($sql)); $this->assertEquals("CREATE TABLE decimal_model (id INT AUTO_INCREMENT NOT NULL, `decimal` NUMERIC(5, 2) NOT NULL, `high_scale` NUMERIC(14, 4) NOT NULL, PRIMARY KEY(id)) ENGINE = InnoDB", $sql[0]); } - + public function testGetCreateSchemaSql3() { $classes = array( @@ -60,7 +60,7 @@ class MySqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase $tool = new SchemaTool($this->_em); $sql = $tool->getCreateSchemaSql($classes); - + $this->assertEquals(1, count($sql)); $this->assertEquals("CREATE TABLE boolean_model (id INT AUTO_INCREMENT NOT NULL, booleanField TINYINT(1) NOT NULL, PRIMARY KEY(id)) ENGINE = InnoDB", $sql[0]); } diff --git a/tests/Doctrine/Tests/ORM/Functional/StandardEntityPersisterTest.php b/tests/Doctrine/Tests/ORM/Functional/StandardEntityPersisterTest.php index e8132de5c..de103eb07 100644 --- a/tests/Doctrine/Tests/ORM/Functional/StandardEntityPersisterTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/StandardEntityPersisterTest.php @@ -6,7 +6,7 @@ use Doctrine\Tests\Models\ECommerce\ECommerceCart, Doctrine\Tests\Models\ECommerce\ECommerceFeature, Doctrine\Tests\Models\ECommerce\ECommerceCustomer, Doctrine\Tests\Models\ECommerce\ECommerceProduct; - + use Doctrine\ORM\Mapping\AssociationMapping; require_once __DIR__ . '/../../TestInit.php'; @@ -24,7 +24,7 @@ class StandardEntityPersisterTest extends \Doctrine\Tests\OrmFunctionalTestCase } public function testAcceptsForeignKeysAsCriteria() - { + { $customer = new ECommerceCustomer(); $customer->setName('John Doe'); $cart = new ECommerceCart(); @@ -35,16 +35,16 @@ class StandardEntityPersisterTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->clear(); $cardId = $cart->getId(); unset($cart); - + $class = $this->_em->getClassMetadata('Doctrine\Tests\Models\ECommerce\ECommerceCart'); - + $persister = $this->_em->getUnitOfWork()->getEntityPersister('Doctrine\Tests\Models\ECommerce\ECommerceCart'); $newCart = new ECommerceCart(); $this->_em->getUnitOfWork()->registerManaged($newCart, array('id' => $cardId), array()); $persister->load(array('customer_id' => $customer->getId()), $newCart, $class->associationMappings['customer']); $this->assertEquals('Credit card', $newCart->getPayment()); } - + /** * Ticket #2478 from Damon Jones (dljones) */ @@ -62,7 +62,7 @@ class StandardEntityPersisterTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->persist($p); $this->_em->flush(); - + $this->assertEquals(2, count($p->getFeatures())); $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $p->getFeatures()); @@ -71,12 +71,12 @@ class StandardEntityPersisterTest extends \Doctrine\Tests\OrmFunctionalTestCase FROM Doctrine\Tests\Models\ECommerce\ECommerceProduct p JOIN p.features f' ); - + $res = $q->getResult(); - + $this->assertEquals(2, count($p->getFeatures())); $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $p->getFeatures()); - + // Check that the features are the same instances still foreach ($p->getFeatures() as $feature) { if ($feature->getDescription() == 'AC-3') { @@ -85,25 +85,25 @@ class StandardEntityPersisterTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertTrue($feature === $f2); } } - - // Now we test how Hydrator affects IdentityMap + + // Now we test how Hydrator affects IdentityMap // (change from ArrayCollection to PersistentCollection) $f3 = new ECommerceFeature(); $f3->setDescription('XVID'); $p->addFeature($f3); - + // Now we persist the Feature #3 $this->_em->persist($p); $this->_em->flush(); - + $q = $this->_em->createQuery( 'SELECT p, f FROM Doctrine\Tests\Models\ECommerce\ECommerceProduct p JOIN p.features f' ); - + $res = $q->getResult(); - + // Persisted Product now must have 3 Feature items $this->assertEquals(3, count($res[0]->getFeatures())); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1041Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1041Test.php index cf5a5f223..5b30c043e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1041Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1041Test.php @@ -15,17 +15,17 @@ class DDC1041Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->useModelSet('company'); parent::setUp(); } - + public function testGrabWrongSubtypeReturnsNull() { $fix = new \Doctrine\Tests\Models\Company\CompanyFixContract(); $fix->setFixPrice(2000); - + $this->_em->persist($fix); $this->_em->flush(); - + $id = $fix->getId(); - + $this->assertNull($this->_em->find('Doctrine\Tests\Models\Company\CompanyFlexContract', $id)); $this->assertNull($this->_em->getReference('Doctrine\Tests\Models\Company\CompanyFlexContract', $id)); $this->assertNull($this->_em->getPartialReference('Doctrine\Tests\Models\Company\CompanyFlexContract', $id)); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1050Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1050Test.php index 82e9590c0..31c0733e0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1050Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1050Test.php @@ -16,7 +16,7 @@ class DDC1050Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->useModelSet('cms'); parent::setUp(); } - + public function testPerformance() { for ($i = 2; $i < 10000; ++$i) { @@ -28,7 +28,7 @@ class DDC1050Test extends \Doctrine\Tests\OrmFunctionalTestCase } $this->_em->flush(); $this->_em->clear(); - + $s = microtime(true); $users = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser')->findAll(); $e = microtime(true); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1080Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1080Test.php index 50b02e350..2b9d579a5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1080Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1080Test.php @@ -16,50 +16,50 @@ class DDC1080Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1080Bar'), $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1080FooBar'), )); - + $foo1 = new DDC1080Foo(); $foo1->setFooTitle('foo title 1'); $foo2 = new DDC1080Foo(); $foo2->setFooTitle('foo title 2'); - + $bar1 = new DDC1080Bar(); $bar1->setBarTitle('bar title 1'); $bar2 = new DDC1080Bar(); $bar2->setBarTitle('bar title 2'); $bar3 = new DDC1080Bar(); $bar3->setBarTitle('bar title 3'); - + $foobar1 = new DDC1080FooBar(); $foobar1->setFoo($foo1); $foobar1->setBar($bar1); $foobar1->setOrderNr(0); - + $foobar2 = new DDC1080FooBar(); $foobar2->setFoo($foo1); $foobar2->setBar($bar2); $foobar2->setOrderNr(0); - + $foobar3 = new DDC1080FooBar(); $foobar3->setFoo($foo1); $foobar3->setBar($bar3); $foobar3->setOrderNr(0); - + $this->_em->persist($foo1); $this->_em->persist($foo2); $this->_em->persist($bar1); $this->_em->persist($bar2); $this->_em->persist($bar3); $this->_em->flush(); - + $this->_em->persist($foobar1); $this->_em->persist($foobar2); $this->_em->persist($foobar3); $this->_em->flush(); $this->_em->clear(); - + $foo = $this->_em->find('Doctrine\Tests\ORM\Functional\Ticket\DDC1080Foo', $foo1->getFooId()); $fooBars = $foo->getFooBars(); - + $this->assertEquals(3, count($fooBars), "Should return three foobars."); } } @@ -73,7 +73,7 @@ class DDC1080Foo { /** - * @Id + * @Id * @Column(name="fooID", type="integer") * @GeneratedValue(strategy="AUTO") */ @@ -151,7 +151,7 @@ class DDC1080Bar { /** - * @Id + * @Id * @Column(name="barID", type="integer") * @GeneratedValue(strategy="AUTO") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1163Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1163Test.php index 7142ff211..1e8cae6db 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1163Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1163Test.php @@ -61,7 +61,7 @@ class DDC1163Test extends \Doctrine\Tests\OrmFunctionalTestCase { /* @var $proxyHolder ProxyHolder */ $proxyHolder = $this->_em->find(__NAMESPACE__ . '\\DDC1163ProxyHolder', $this->proxyHolderId); - + $this->assertInstanceOf(__NAMESPACE__.'\\DDC1163SpecialProduct', $proxyHolder->getSpecialProduct()); } @@ -72,9 +72,9 @@ class DDC1163Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertInstanceOf(__NAMESPACE__.'\\DDC1163SpecialProduct', $specialProduct); $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $specialProduct); - + $specialProduct->setSubclassProperty('foobar'); - + // this screams violation of law of demeter ;) $this->assertEquals( __NAMESPACE__.'\\DDC1163SpecialProduct', @@ -115,7 +115,7 @@ class DDC1163ProxyHolder { $this->specialProduct = $specialProduct; } - + public function getSpecialProduct() { return $this->specialProduct; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php index c79bd2f46..bee6ef971 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php @@ -349,7 +349,7 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase public function testLoadInverseManyToManyCollection() { $editor = $this->loadEditorFixture(); - + $this->assertInstanceOf('Doctrine\Tests\Models\DDC117\DDC117Translation', $editor->reviewingTranslations[0]); $reviewedBy = $editor->reviewingTranslations[0]->getReviewedByEditors(); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1181Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1181Test.php index 225353034..32856ace1 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1181Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1181Test.php @@ -15,7 +15,7 @@ class DDC1181Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1181Room'), )); } - + /** * @group DDC-1181 */ @@ -24,12 +24,12 @@ class DDC1181Test extends \Doctrine\Tests\OrmFunctionalTestCase $hotel = new DDC1181Hotel(); $room1 = new DDC1181Room(); $room2 = new DDC1181Room(); - + $this->_em->persist($hotel); $this->_em->persist($room1); $this->_em->persist($room2); $this->_em->flush(); - + $booking1 = new DDC1181Booking; $booking1->hotel = $hotel; $booking1->room = $room1; @@ -38,11 +38,11 @@ class DDC1181Test extends \Doctrine\Tests\OrmFunctionalTestCase $booking2->room = $room2; $hotel->bookings[] = $booking1; $hotel->bookings[] = $booking2; - + $this->_em->persist($booking1); $this->_em->persist($booking2); $this->_em->flush(); - + $this->_em->remove($hotel); $this->_em->flush(); } @@ -72,7 +72,7 @@ class DDC1181Booking /** * @var Hotel * - * @Id + * @Id * @ManyToOne(targetEntity="DDC1181Hotel", inversedBy="bookings") * @JoinColumns({ * @JoinColumn(name="hotel_id", referencedColumnName="id") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php index 3ddf37e70..6465fa675 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php @@ -45,7 +45,7 @@ class DDC1193Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertTrue($this->_em->getUnitOfWork()->isInIdentityMap($company), "Company is in identity map."); $this->assertFalse($company->member->__isInitialized__, "Pre-Condition"); $this->assertTrue($this->_em->getUnitOfWork()->isInIdentityMap($company->member), "Member is in identity map."); - + $this->_em->remove($company); $this->_em->flush(); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1276Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1276Test.php index 1b9dc8c99..a4f54b55f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1276Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1276Test.php @@ -38,7 +38,7 @@ class DDC1276Test extends \Doctrine\Tests\OrmFunctionalTestCase $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); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1383Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1383Test.php index 6a8cf483a..f6b5a2460 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1383Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1383Test.php @@ -13,7 +13,7 @@ class DDC1383Test extends \Doctrine\Tests\OrmFunctionalTestCase protected function setUp() { parent::setUp(); - + try { $this->_schemaTool->createSchema(array( $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1383AbstractEntity'), @@ -26,25 +26,25 @@ class DDC1383Test extends \Doctrine\Tests\OrmFunctionalTestCase { $parent = new DDC1383Entity(); $child = new DDC1383Entity(); - + $child->setReference($parent); - + $this->_em->persist($parent); $this->_em->persist($child); - + $id = $child->getId(); - + $this->_em->flush(); $this->_em->clear(); - + // Try merging the parent entity $child = $this->_em->merge($child); $parent = $child->getReference(); - + // Parent is not instance of the abstract class self::assertTrue($parent instanceof DDC1383AbstractEntity, "Entity class is " . get_class($parent) . ', "DDC1383AbstractEntity" was expected'); - + // Parent is NOT instance of entity self::assertTrue($parent instanceof DDC1383Entity, "Entity class is " . get_class($parent) . ', "DDC1383Entity" was expected'); @@ -65,7 +65,7 @@ abstract class DDC1383AbstractEntity * @GeneratedValue */ protected $id; - + public function getId() { return $this->id; @@ -86,7 +86,7 @@ class DDC1383Entity extends DDC1383AbstractEntity * @ManyToOne(targetEntity="DDC1383AbstractEntity") */ protected $reference; - + public function getReference() { return $this->reference; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1404Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1404Test.php index 49a282772..cc1d7c9ee 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1404Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1404Test.php @@ -19,9 +19,9 @@ class DDC1404Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1404ParentEntity'), $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1404ChildEntity'), )); - + $this->loadFixtures(); - + } catch (Exception $exc) { } } @@ -32,27 +32,27 @@ class DDC1404Test extends \Doctrine\Tests\OrmFunctionalTestCase $queryAll = $repository->createNamedQuery('all'); $queryFirst = $repository->createNamedQuery('first'); $querySecond = $repository->createNamedQuery('second'); - - + + $this->assertEquals('SELECT p FROM Doctrine\Tests\ORM\Functional\Ticket\DDC1404ChildEntity p', $queryAll->getDQL()); $this->assertEquals('SELECT p FROM Doctrine\Tests\ORM\Functional\Ticket\DDC1404ChildEntity p WHERE p.id = 1', $queryFirst->getDQL()); $this->assertEquals('SELECT p FROM Doctrine\Tests\ORM\Functional\Ticket\DDC1404ChildEntity p WHERE p.id = 2', $querySecond->getDQL()); - - + + $this->assertEquals(sizeof($queryAll->getResult()), 2); $this->assertEquals(sizeof($queryFirst->getResult()), 1); $this->assertEquals(sizeof($querySecond->getResult()), 1); } - - + + public function loadFixtures() { $c1 = new DDC1404ChildEntity("ChildEntity 1"); $c2 = new DDC1404ChildEntity("ChildEntity 2"); - + $this->_em->persist($c1); $this->_em->persist($c2); - + $this->_em->flush(); } @@ -60,7 +60,7 @@ class DDC1404Test extends \Doctrine\Tests\OrmFunctionalTestCase /** * @MappedSuperclass - * + * * @NamedQueries({ * @NamedQuery(name="all", query="SELECT p FROM __CLASS__ p"), * @NamedQuery(name="first", query="SELECT p FROM __CLASS__ p WHERE p.id = 1"), @@ -70,7 +70,7 @@ class DDC1404ParentEntity { /** - * @Id + * @Id * @Column(type="integer") * @GeneratedValue() */ @@ -88,7 +88,7 @@ class DDC1404ParentEntity /** * @Entity - * + * * @NamedQueries({ * @NamedQuery(name="first", query="SELECT p FROM __CLASS__ p WHERE p.id = 1"), * @NamedQuery(name="second", query="SELECT p FROM __CLASS__ p WHERE p.id = 2") @@ -98,12 +98,12 @@ class DDC1404ChildEntity extends DDC1404ParentEntity { /** - * @column(type="string") + * @column(type="string") */ private $name; - + /** - * @param string $name + * @param string $name */ public function __construct($name) { @@ -111,7 +111,7 @@ class DDC1404ChildEntity extends DDC1404ParentEntity } /** - * @return string + * @return string */ public function getName() { @@ -119,7 +119,7 @@ class DDC1404ChildEntity extends DDC1404ParentEntity } /** - * @param string $name + * @param string $name */ public function setName($name) { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1430Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1430Test.php index ec2c89a09..a8102239d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1430Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1430Test.php @@ -21,7 +21,7 @@ class DDC1430Test extends \Doctrine\Tests\OrmFunctionalTestCase )); $this->loadFixtures(); } catch (\Exception $exc) { - + } } @@ -34,28 +34,28 @@ class DDC1430Test extends \Doctrine\Tests\OrmFunctionalTestCase ->groupBy('o.id, o.date') ->orderBy('o.id') ->getQuery(); - + $this->assertEquals('SELECT o.id, o.date, COUNT(p.id) AS p_count FROM Doctrine\Tests\ORM\Functional\Ticket\DDC1430Order o LEFT JOIN o.products p GROUP BY o.id, o.date ORDER BY o.id ASC', $query->getDQL()); $this->assertEquals('SELECT d0_.order_id AS order_id0, d0_.created_at AS created_at1, COUNT(d1_.id) AS sclr2 FROM DDC1430Order d0_ LEFT JOIN DDC1430OrderProduct d1_ ON d0_.order_id = d1_.order_id GROUP BY d0_.order_id, d0_.created_at ORDER BY d0_.order_id ASC', $query->getSQL()); - + $result = $query->getResult(); - + $this->assertEquals(2, sizeof($result)); - + $this->assertArrayHasKey('id', $result[0]); $this->assertArrayHasKey('id', $result[1]); - + $this->assertArrayHasKey('p_count', $result[0]); $this->assertArrayHasKey('p_count', $result[1]); - + $this->assertEquals(1, $result[0]['id']); $this->assertEquals(2, $result[1]['id']); - + $this->assertEquals(2, $result[0]['p_count']); $this->assertEquals(3, $result[1]['p_count']); } - + public function testOrderByAllObjectFields() { $repository = $this->_em->getRepository(__NAMESPACE__ . '\DDC1430Order'); @@ -65,26 +65,26 @@ class DDC1430Test extends \Doctrine\Tests\OrmFunctionalTestCase ->groupBy('o.id, o.date, o.status') ->orderBy('o.id') ->getQuery(); - - + + $this->assertEquals('SELECT o, COUNT(p.id) AS p_count FROM Doctrine\Tests\ORM\Functional\Ticket\DDC1430Order o LEFT JOIN o.products p GROUP BY o.id, o.date, o.status ORDER BY o.id ASC', $query->getDQL()); $this->assertEquals('SELECT d0_.order_id AS order_id0, d0_.created_at AS created_at1, d0_.order_status AS order_status2, COUNT(d1_.id) AS sclr3 FROM DDC1430Order d0_ LEFT JOIN DDC1430OrderProduct d1_ ON d0_.order_id = d1_.order_id GROUP BY d0_.order_id, d0_.created_at, d0_.order_status ORDER BY d0_.order_id ASC', $query->getSQL()); - + $result = $query->getResult(); - - + + $this->assertEquals(2, sizeof($result)); - + $this->assertTrue($result[0][0] instanceof DDC1430Order); $this->assertTrue($result[1][0] instanceof DDC1430Order); - + $this->assertEquals($result[0][0]->getId(), 1); $this->assertEquals($result[1][0]->getId(), 2); - + $this->assertEquals($result[0]['p_count'], 2); $this->assertEquals($result[1]['p_count'], 3); } - + public function testTicket() { $repository = $this->_em->getRepository(__NAMESPACE__ . '\DDC1430Order'); @@ -94,22 +94,22 @@ class DDC1430Test extends \Doctrine\Tests\OrmFunctionalTestCase ->groupBy('o') ->orderBy('o.id') ->getQuery(); - - + + $this->assertEquals('SELECT o, COUNT(p.id) AS p_count FROM Doctrine\Tests\ORM\Functional\Ticket\DDC1430Order o LEFT JOIN o.products p GROUP BY o ORDER BY o.id ASC', $query->getDQL()); $this->assertEquals('SELECT d0_.order_id AS order_id0, d0_.created_at AS created_at1, d0_.order_status AS order_status2, COUNT(d1_.id) AS sclr3 FROM DDC1430Order d0_ LEFT JOIN DDC1430OrderProduct d1_ ON d0_.order_id = d1_.order_id GROUP BY d0_.order_id, d0_.created_at, d0_.order_status ORDER BY d0_.order_id ASC', $query->getSQL()); - - + + $result = $query->getResult(); - + $this->assertEquals(2, sizeof($result)); - + $this->assertTrue($result[0][0] instanceof DDC1430Order); $this->assertTrue($result[1][0] instanceof DDC1430Order); - + $this->assertEquals($result[0][0]->getId(), 1); $this->assertEquals($result[1][0]->getId(), 2); - + $this->assertEquals($result[0]['p_count'], 2); $this->assertEquals($result[1]['p_count'], 3); } @@ -118,14 +118,14 @@ class DDC1430Test extends \Doctrine\Tests\OrmFunctionalTestCase { $o1 = new DDC1430Order('NEW'); $o2 = new DDC1430Order('OK'); - + $o1->addProduct(new DDC1430OrderProduct(1.1)); $o1->addProduct(new DDC1430OrderProduct(1.2)); $o2->addProduct(new DDC1430OrderProduct(2.1)); $o2->addProduct(new DDC1430OrderProduct(2.2)); $o2->addProduct(new DDC1430OrderProduct(2.3)); - + $this->_em->persist($o1); $this->_em->persist($o2); @@ -141,25 +141,25 @@ class DDC1430Order { /** - * @Id + * @Id * @Column(name="order_id", type="integer") * @GeneratedValue() */ protected $id; /** - * @Column(name="created_at", type="datetime") + * @Column(name="created_at", type="datetime") */ private $date; - + /** - * @Column(name="order_status", type="string") + * @Column(name="order_status", type="string") */ private $status; /** * @OneToMany(targetEntity="DDC1430OrderProduct", mappedBy="order", cascade={"persist", "remove"}) - * + * * @var \Doctrine\Common\Collections\ArrayCollection $products */ private $products; @@ -185,23 +185,23 @@ class DDC1430Order { return $this->date; } - + /** - * @return string + * @return string */ public function getStatus() { return $this->status; } - + /** - * @param string $status + * @param string $status */ public function setStatus($status) { $this->status = $status; } - + /** * @return \Doctrine\Common\Collections\ArrayCollection */ @@ -209,9 +209,9 @@ class DDC1430Order { return $this->products; } - + /** - * @param DDC1430OrderProduct $product + * @param DDC1430OrderProduct $product */ public function addProduct(DDC1430OrderProduct $product) { @@ -227,33 +227,33 @@ class DDC1430OrderProduct { /** - * @Id + * @Id * @Column(type="integer") * @GeneratedValue() */ protected $id; - + /** * @var DDC1430Order $order - * + * * @ManyToOne(targetEntity="DDC1430Order", inversedBy="products") * @JoinColumn(name="order_id", referencedColumnName="order_id", nullable = false) */ private $order; /** - * @column(type="float") + * @column(type="float") */ private $value; - + /** - * @param float $value + * @param float $value */ public function __construct($value) { $this->value = $value; } - + /** * @return integer */ @@ -263,7 +263,7 @@ class DDC1430OrderProduct } /** - * @return DDC1430Order + * @return DDC1430Order */ public function getOrder() { @@ -271,7 +271,7 @@ class DDC1430OrderProduct } /** - * @param DDC1430Order $order + * @param DDC1430Order $order */ public function setOrder(DDC1430Order $order) { @@ -279,7 +279,7 @@ class DDC1430OrderProduct } /** - * @return float + * @return float */ public function getValue() { @@ -287,7 +287,7 @@ class DDC1430OrderProduct } /** - * @param float $value + * @param float $value */ public function setValue($value) { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC144Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC144Test.php index 82a2e314c..dd6391a74 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC144Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC144Test.php @@ -9,27 +9,27 @@ class DDC144Test extends \Doctrine\Tests\OrmFunctionalTestCase protected function setUp() { parent::setUp(); //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger); - + $this->_schemaTool->createSchema(array( $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC144FlowElement'), // $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC144Expression'), $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC144Operand'), )); - + } - + /** * @group DDC-144 */ public function testIssue() { - + $operand = new DDC144Operand; $operand->property = 'flowValue'; $operand->operandProperty = 'operandValue'; $this->_em->persist($operand); $this->_em->flush(); - + } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1458Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1458Test.php index 2a0541afd..745b51c28 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1458Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1458Test.php @@ -88,7 +88,7 @@ class TestEntity { return $this->additional; } - + public function setAdditional($additional) { $this->additional = $additional; @@ -123,7 +123,7 @@ class TestAdditionalEntity { return $this->bool; } - + public function setBool($bool) { $this->bool = $bool; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1461Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1461Test.php index a47571a75..e6aa2e6bc 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1461Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1461Test.php @@ -25,7 +25,7 @@ class DDC1461Test extends \Doctrine\Tests\OrmFunctionalTestCase } } - + public function testChangeDetectionDeferredExplicit() { $user = new DDC1461User; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php index 7f7e7d575..6ba0cd42f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php @@ -21,7 +21,7 @@ class DDC1509Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1509Picture'), )); } catch (\Exception $ignored) { - + } } @@ -142,5 +142,5 @@ class DDC1509AbstractFile */ class DDC1509File extends DDC1509AbstractFile { - + } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1514Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1514Test.php index c905d0048..cc0f9728d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1514Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1514Test.php @@ -1,111 +1,111 @@ -_schemaTool->createSchema(array( - $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1514EntityA'), - $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1514EntityB'), - $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1514EntityC'), - )); - } catch (\Exception $ignored) { - } - } - - public function testIssue() - { - $a1 = new DDC1514EntityA(); - $a1->title = "foo"; - - $a2 = new DDC1514EntityA(); - $a2->title = "bar"; - - $b1 = new DDC1514EntityB(); - $b1->entityAFrom = $a1; - $b1->entityATo = $a2; - - $b2 = new DDC1514EntityB(); - $b2->entityAFrom = $a2; - $b2->entityATo = $a1; - - $c = new DDC1514EntityC(); - $c->title = "baz"; - $a2->entityC = $c; - - $this->_em->persist($a1); - $this->_em->persist($a2); - $this->_em->persist($b1); - $this->_em->persist($b2); - $this->_em->persist($c); - $this->_em->flush(); - $this->_em->clear(); - - $dql = "SELECT a, b, ba, c FROM " . __NAMESPACE__ . "\DDC1514EntityA AS a LEFT JOIN a.entitiesB AS b LEFT JOIN b.entityATo AS ba LEFT JOIN a.entityC AS c"; - $results = $this->_em->createQuery($dql)->getResult(); - - $this->assertEquals($c->title, $results[1]->entityC->title); - } -} - -/** - * @Entity - */ -class DDC1514EntityA -{ - /** @Id @Column(type="integer") @GeneratedValue */ - public $id; - /** @Column */ - public $title; - /** @ManyToMany(targetEntity="DDC1514EntityB", mappedBy="entityAFrom") */ - public $entitiesB; - /** @ManyToOne(targetEntity="DDC1514EntityC") */ - public $entityC; - - public function __construct() - { - $this->entitiesB = new ArrayCollection(); - } -} - -/** - * @Entity - */ -class DDC1514EntityB -{ - /** @Id @Column(type="integer") @GeneratedValue */ - public $id; - - /** - * @ManyToOne(targetEntity="DDC1514EntityA", inversedBy="entitiesB") - */ - public $entityAFrom; - /** - * @ManyToOne(targetEntity="DDC1514EntityA") - */ - public $entityATo; -} - -/** - * @Entity - */ -class DDC1514EntityC -{ - /** @Id @Column(type="integer") @GeneratedValue */ - public $id; - /** @Column */ - public $title; -} +_schemaTool->createSchema(array( + $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1514EntityA'), + $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1514EntityB'), + $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1514EntityC'), + )); + } catch (\Exception $ignored) { + } + } + + public function testIssue() + { + $a1 = new DDC1514EntityA(); + $a1->title = "foo"; + + $a2 = new DDC1514EntityA(); + $a2->title = "bar"; + + $b1 = new DDC1514EntityB(); + $b1->entityAFrom = $a1; + $b1->entityATo = $a2; + + $b2 = new DDC1514EntityB(); + $b2->entityAFrom = $a2; + $b2->entityATo = $a1; + + $c = new DDC1514EntityC(); + $c->title = "baz"; + $a2->entityC = $c; + + $this->_em->persist($a1); + $this->_em->persist($a2); + $this->_em->persist($b1); + $this->_em->persist($b2); + $this->_em->persist($c); + $this->_em->flush(); + $this->_em->clear(); + + $dql = "SELECT a, b, ba, c FROM " . __NAMESPACE__ . "\DDC1514EntityA AS a LEFT JOIN a.entitiesB AS b LEFT JOIN b.entityATo AS ba LEFT JOIN a.entityC AS c"; + $results = $this->_em->createQuery($dql)->getResult(); + + $this->assertEquals($c->title, $results[1]->entityC->title); + } +} + +/** + * @Entity + */ +class DDC1514EntityA +{ + /** @Id @Column(type="integer") @GeneratedValue */ + public $id; + /** @Column */ + public $title; + /** @ManyToMany(targetEntity="DDC1514EntityB", mappedBy="entityAFrom") */ + public $entitiesB; + /** @ManyToOne(targetEntity="DDC1514EntityC") */ + public $entityC; + + public function __construct() + { + $this->entitiesB = new ArrayCollection(); + } +} + +/** + * @Entity + */ +class DDC1514EntityB +{ + /** @Id @Column(type="integer") @GeneratedValue */ + public $id; + + /** + * @ManyToOne(targetEntity="DDC1514EntityA", inversedBy="entitiesB") + */ + public $entityAFrom; + /** + * @ManyToOne(targetEntity="DDC1514EntityA") + */ + public $entityATo; +} + +/** + * @Entity + */ +class DDC1514EntityC +{ + /** @Id @Column(type="integer") @GeneratedValue */ + public $id; + /** @Column */ + public $title; +} diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1548Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1548Test.php index 0baeca2f7..dc77ed60e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1548Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1548Test.php @@ -30,7 +30,7 @@ class DDC1548Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->clear(); $obt = $this->_em->find(__NAMESPACE__ . '\DDC1548Rel', $rel->id); - + $this->assertNull($obt->e2); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC168Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC168Test.php index 004acfa8c..25b63a8dc 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC168Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC168Test.php @@ -15,7 +15,7 @@ class DDC168Test extends \Doctrine\Tests\OrmFunctionalTestCase parent::setUp(); $this->oldMetadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\Company\CompanyEmployee'); - + $metadata = clone $this->oldMetadata; ksort($metadata->reflFields); $this->_em->getMetadataFactory()->setMetadataFor('Doctrine\Tests\Models\Company\CompanyEmployee', $metadata); @@ -26,7 +26,7 @@ class DDC168Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->getMetadataFactory()->setMetadataFor('Doctrine\Tests\Models\Company\CompanyEmployee', $this->oldMetadata); parent::tearDown(); } - + /** * @group DDC-168 */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC192Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC192Test.php index 2238c0319..18eb76943 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC192Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC192Test.php @@ -20,13 +20,13 @@ class DDC192Test extends \Doctrine\Tests\OrmFunctionalTestCase * @Entity @Table(name="ddc192_users") */ class DDC192User -{ +{ /** - * @Id @Column(name="id", type="integer") + * @Id @Column(name="id", type="integer") * @GeneratedValue(strategy="AUTO") */ public $id; - + /** * @Column(name="name", type="string") */ @@ -43,23 +43,23 @@ class DDC192Phonenumber * @Id @Column(name="phone", type="string", length=40) */ protected $phone; - + /** * @Id * @ManyToOne(targetEntity="DDC192User") * @JoinColumn(name="userId", referencedColumnName="id") */ protected $User; - - + + public function setPhone($value) { $this->phone = $value; } - + public function getPhone() { return $this->phone; } - - public function setUser(User $user) + + public function setUser(User $user) { $this->User = $user; } - + public function getUser() { return $this->User; } } \ 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 8b5eddbf8..9084ec0a6 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php @@ -15,30 +15,30 @@ class DDC199Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC199RelatedClass') )); } - + public function testPolymorphicLoading() { $child = new DDC199ChildClass; $child->parentData = 'parentData'; $child->childData = 'childData'; $this->_em->persist($child); - + $related1 = new DDC199RelatedClass; $related1->relatedData = 'related1'; $related1->parent = $child; $this->_em->persist($related1); - + $related2 = new DDC199RelatedClass; $related2->relatedData = 'related2'; $related2->parent = $child; $this->_em->persist($related2); - + $this->_em->flush(); $this->_em->clear(); - + $query = $this->_em->createQuery('select e,r from Doctrine\Tests\ORM\Functional\Ticket\DDC199ParentClass e join e.relatedEntities r'); $result = $query->getResult(); - + $this->assertEquals(1, count($result)); $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC199ParentClass', $result[0]); $this->assertTrue($result[0]->relatedEntities->isInitialized()); @@ -56,18 +56,18 @@ class DDC199Test extends \Doctrine\Tests\OrmFunctionalTestCase * @DiscriminatorMap({"parent" = "DDC199ParentClass", "child" = "DDC199ChildClass"}) */ class DDC199ParentClass -{ +{ /** - * @Id @Column(type="integer") + * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ public $id; - + /** * @Column(type="string") */ public $parentData; - + /** * @OneToMany(targetEntity="DDC199RelatedClass", mappedBy="parent") */ @@ -91,7 +91,7 @@ class DDC199RelatedClass public $id; /** @Column */ public $relatedData; - + /** * @ManyToOne(targetEntity="DDC199ParentClass", inversedBy="relatedEntities") * @JoinColumn(name="parent_id", referencedColumnName="id") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC211Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC211Test.php index 27abee236..6104c9cae 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC211Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC211Test.php @@ -14,11 +14,11 @@ class DDC211Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC211Group') )); } - + public function testIssue() { //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger); - + $user = new DDC211User; $user->setName('John Doe'); @@ -41,7 +41,7 @@ class DDC211Test extends \Doctrine\Tests\OrmFunctionalTestCase } $this->assertEquals(4, $user->getGroups()->count()); - + } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php index 87939ff71..413e56413 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php @@ -15,33 +15,33 @@ class DDC237Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC237EntityZ') )); } - + public function testUninitializedProxyIsInitializedOnFetchJoin() { $x = new DDC237EntityX; $y = new DDC237EntityY; $z = new DDC237EntityZ; - + $x->data = 'X'; $y->data = 'Y'; $z->data = 'Z'; - + $x->y = $y; $z->y = $y; - + $this->_em->persist($x); $this->_em->persist($y); $this->_em->persist($z); - - $this->_em->flush(); + + $this->_em->flush(); $this->_em->clear(); - + $x2 = $this->_em->find(get_class($x), $x->id); // proxy injected for Y $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $x2->y); $this->assertFalse($x2->y->__isInitialized__); - + // proxy for Y is in identity map - + $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(); @@ -49,7 +49,7 @@ class DDC237Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertTrue($z2->y->__isInitialized__); $this->assertEquals('Y', $z2->y->data); $this->assertEquals($y->id, $z2->y->id); - + // since the Y is the same, the instance from the identity map is // used, even if it is a proxy. @@ -57,7 +57,7 @@ class DDC237Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertNotSame($z, $z2); $this->assertSame($z2->y, $x2->y); $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $z2->y); - + } } @@ -66,7 +66,7 @@ class DDC237Test extends \Doctrine\Tests\OrmFunctionalTestCase * @Entity @Table(name="ddc237_x") */ class DDC237EntityX -{ +{ /** * @Id @Column(type="integer") @GeneratedValue */ @@ -103,7 +103,7 @@ class DDC237EntityZ public $id; /** @Column(type="string") */ public $data; - + /** * @OneToOne(targetEntity="DDC237EntityY") * @JoinColumn(name="y_id", referencedColumnName="id") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php index d1bcc166e..0d766eaa0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php @@ -22,7 +22,7 @@ class DDC258Test extends \Doctrine\Tests\OrmFunctionalTestCase public function testIssue() { //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger); - + $c1 = new DDC258Class1(); $c1->title = "Foo"; $c1->description = "Foo"; @@ -48,9 +48,9 @@ class DDC258Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertEquals('Bar', $e2->title); $this->assertEquals('Bar', $e2->description); $this->assertEquals('Bar', $e2->text); - + $all = $this->_em->getRepository(__NAMESPACE__.'\DDC258Super')->findAll(); - + foreach ($all as $obj) { if ($obj instanceof DDC258Class1) { $this->assertEquals('Foo', $obj->title); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC279Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC279Test.php index 50bc5ec1a..6d41ea8d8 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC279Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC279Test.php @@ -44,14 +44,14 @@ class DDC279Test extends \Doctrine\Tests\OrmFunctionalTestCase 'SELECT x, y, z FROM Doctrine\Tests\ORM\Functional\Ticket\DDC279EntityX x '. 'INNER JOIN x.y y INNER JOIN y.z z WHERE x.id = ?1' )->setParameter(1, $x->id); - + $result = $query->getResult(); - + $expected1 = 'Y'; $expected2 = 'Z'; $this->assertEquals(1, count($result)); - + $this->assertEquals($expected1, $result[0]->y->data); $this->assertEquals($expected2, $result[0]->y->z->data); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php index fc2c3fc6d..757b5ab0b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php @@ -45,7 +45,7 @@ class DDC345Test extends \Doctrine\Tests\OrmFunctionalTestCase $group->Memberships->add($membership); $this->_em->flush(); - + $this->assertEquals(1, $membership->prePersistCallCount); $this->assertEquals(0, $membership->preUpdateCallCount); $this->assertInstanceOf('DateTime', $membership->updated); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC353Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC353Test.php index 40f4ca298..df783593a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC353Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC353Test.php @@ -57,7 +57,7 @@ class DDC353Test extends \Doctrine\Tests\OrmFunctionalTestCase $fileId = $file->getFileId(); $pictureId = $picture->getPictureId(); - + $this->assertTrue($fileId > 0); $picture = $em->find('Doctrine\Tests\ORM\Functional\Ticket\DDC353Picture', $pictureId); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php index ad1584fa0..54f76b1a7 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php @@ -22,24 +22,24 @@ class DDC371Test extends \Doctrine\Tests\OrmFunctionalTestCase $parent = new DDC371Parent; $parent->data = 'parent'; $parent->children = new \Doctrine\Common\Collections\ArrayCollection; - + $child = new DDC371Child; $child->data = 'child'; - + $child->parent = $parent; $parent->children->add($child); - + $this->_em->persist($parent); $this->_em->persist($child); - + $this->_em->flush(); $this->_em->clear(); - + $children = $this->_em->createQuery('select c,p from '.__NAMESPACE__.'\DDC371Child c ' . 'left join c.parent p where c.id = 1 and p.id = 1') ->setHint(Query::HINT_REFRESH, true) ->getResult(); - + $this->assertEquals(1, count($children)); $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $children[0]->parent); $this->assertFalse($children[0]->parent->children->isInitialized()); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC381Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC381Test.php index 678135daf..9b47bc842 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC381Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC381Test.php @@ -55,9 +55,9 @@ class DDC381Entity { return $this->id; } - + public function getOtherMethod() { - + } } \ No newline at end of file diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php index ebe9f9d55..3a6dbdb4c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php @@ -20,14 +20,14 @@ class DDC422Test extends \Doctrine\Tests\OrmFunctionalTestCase * @group DDC-422 */ public function testIssue() - { + { $customer = new DDC422Customer; $this->_em->persist($customer); $this->_em->flush(); $this->_em->clear(); - + $customer = $this->_em->find(get_class($customer), $customer->id); - + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $customer->contacts); $this->assertFalse($customer->contacts->isInitialized()); $contact = new DDC422Contact; @@ -35,7 +35,7 @@ class DDC422Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertTrue($customer->contacts->isDirty()); $this->assertFalse($customer->contacts->isInitialized()); $this->_em->flush(); - + $this->assertEquals(1, $this->_em->getConnection()->fetchColumn("select count(*) from ddc422_customers_contacts")); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC425Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC425Test.php index 1fbc8ff46..084da5623 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC425Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC425Test.php @@ -37,7 +37,7 @@ class DDC425Entity { * @GeneratedValue */ public $id; - + /** @Column(type="datetime") */ public $someDatetimeField; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php index 46096fe5b..2b374a85d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php @@ -28,12 +28,12 @@ class DDC440Test extends \Doctrine\Tests\OrmFunctionalTestCase /* The key of the problem is that the first phone is fetched via two association, main_phone and phones. - * + * * You will notice that the original_entity_datas are not loaded for the first phone. (They are for the second) - * - * In the Client entity definition, if you define the main_phone relation after the phones relation, both assertions pass. + * + * In the Client entity definition, if you define the main_phone relation after the phones relation, both assertions pass. * (for the sake or this test, I defined the main_phone relation before the phones relation) - * + * */ //Initialize some data @@ -169,7 +169,7 @@ class DDC440Client public function __construct() { - + } public function setName($value) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php index e0ce88aa2..d89e67a2f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php @@ -61,13 +61,13 @@ class DDC444Test extends \Doctrine\Tests\OrmFunctionalTestCase * @ChangeTrackingPolicy("DEFERRED_EXPLICIT") */ class DDC444User -{ +{ /** - * @Id @Column(name="id", type="integer") + * @Id @Column(name="id", type="integer") * @GeneratedValue(strategy="AUTO") */ public $id; - + /** * @Column(name="name", type="string") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php index 45c4340dc..22897eed9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php @@ -82,7 +82,7 @@ class DDC501Test extends OrmFunctionalTestCase $this->assertEquals(4, count($userFromEntityManager->getPhonenumbers())); // This works fine as long as cmUser::groups doesn't cascade "merge" - // Otherwise group memberships are physically deleted now! + // Otherwise group memberships are physically deleted now! $this->assertEquals(2, count($userClone->getGroups())); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php index b9c74d399..97245efa7 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php @@ -24,7 +24,7 @@ class DDC512Test extends \Doctrine\Tests\OrmFunctionalTestCase $customer2 = new DDC512Customer(); $this->_em->persist($customer2); - + $this->_em->flush(); $this->_em->clear(); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php index f251522ee..f029e95e9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php @@ -32,7 +32,7 @@ class DDC522Test extends \Doctrine\Tests\OrmFunctionalTestCase public function testJoinColumnWithSameNameAsAssociationField() { //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger); - + $cust = new DDC522Customer; $cust->name = "name"; $cart = new DDC522Cart; @@ -47,7 +47,7 @@ class DDC522Test extends \Doctrine\Tests\OrmFunctionalTestCase $r = $this->_em->createQuery("select ca,c from ".get_class($cart)." ca join ca.customer c") ->getResult(); - + $this->assertInstanceOf(__NAMESPACE__ . '\DDC522Cart', $r[0]); $this->assertInstanceOf(__NAMESPACE__ . '\DDC522Customer', $r[0]->customer); $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $r[0]->customer); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php index 7ce19cfab..5e22c2cbe 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php @@ -25,7 +25,7 @@ class DDC531Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->persist($item2); $this->_em->flush(); $this->_em->clear(); - + $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. diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC618Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC618Test.php index 82cf765c3..b51ed39ba 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC618Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC618Test.php @@ -39,7 +39,7 @@ class DDC618Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->flush(); $this->_em->clear(); } catch(\Exception $e) { - + } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php index 0dd24d50c..2ec438325 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php @@ -17,7 +17,7 @@ class DDC633Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC633Appointment'), )); } catch(\Exception $e) { - + } } @@ -64,7 +64,7 @@ class DDC633Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->clear(); $appointments = $this->_em->createQuery("SELECT a FROM " . __NAMESPACE__ . "\DDC633Appointment a")->getResult(); - + foreach ($appointments AS $eagerAppointment) { $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $eagerAppointment->patient); $this->assertTrue($eagerAppointment->patient->__isInitialized__, "Proxy should already be initialized due to eager loading!"); @@ -79,7 +79,7 @@ class DDC633Appointment { /** @Id @Column(type="integer") @GeneratedValue */ public $id; - + /** * @OneToOne(targetEntity="DDC633Patient", inversedBy="appointment", fetch="EAGER") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php index bd8ce5357..f2bbc2aa9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php @@ -16,7 +16,7 @@ class DDC656Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC656Entity') )); } catch(\Exception $e) { - + } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php index 939c35d7b..376249745 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php @@ -37,7 +37,7 @@ class DDC729Test extends \Doctrine\Tests\OrmFunctionalTestCase $a->id = $aId; $this->assertInstanceOf('Doctrine\Common\Collections\ArrayCollection', $a->related); - + $a = $this->_em->merge($a); $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $a->related); @@ -68,7 +68,7 @@ class DDC729Test extends \Doctrine\Tests\OrmFunctionalTestCase $a = new DDC729A(); $a->id = $aId; - + $a = $this->_em->merge($a); $a->related->set(0, $this->_em->merge($b1)); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC736Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC736Test.php index de9e275bf..2dfeeec6d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC736Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC736Test.php @@ -24,11 +24,11 @@ class DDC736Test extends \Doctrine\Tests\OrmFunctionalTestCase { $cust = new ECommerceCustomer; $cust->setName('roman'); - + $cart = new ECommerceCart; $cart->setPayment('cash'); $cart->setCustomer($cust); - + $this->_em->persist($cust); $this->_em->persist($cart); $this->_em->flush(); @@ -36,7 +36,7 @@ class DDC736Test extends \Doctrine\Tests\OrmFunctionalTestCase $result = $this->_em->createQuery("select c, c.name, ca, ca.payment from Doctrine\Tests\Models\ECommerce\ECommerceCart ca join ca.customer c") ->getSingleResult(/*\Doctrine\ORM\Query::HYDRATE_ARRAY*/); - + $cart2 = $result[0]; unset($result[0]); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC767Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC767Test.php index e3c3975ac..7ba337ecd 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC767Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC767Test.php @@ -52,7 +52,7 @@ class DDC767Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertNotNull($pUser, "User not retrieved from database."); $groups = array(2, 3); - + try { $this->_em->beginTransaction(); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC809Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC809Test.php index 3b0734998..c586afac6 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC809Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC809Test.php @@ -28,7 +28,7 @@ class DDC809Test extends \Doctrine\Tests\OrmFunctionalTestCase $conn->insert('variant_test', array('variant_id' => 545208)); $conn->insert('variant_test', array('variant_id' => 545209)); - + $conn->insert('var_spec_value_test', array('variant_id' => 545208, 'specification_value_id' => 94606)); $conn->insert('var_spec_value_test', array('variant_id' => 545208, 'specification_value_id' => 94607)); $conn->insert('var_spec_value_test', array('variant_id' => 545208, 'specification_value_id' => 94609)); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC812Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC812Test.php index 3bb0a51fd..4a80358d4 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC812Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC812Test.php @@ -24,12 +24,12 @@ class DDC812Test extends \Doctrine\Tests\OrmFunctionalTestCase $article = new CmsArticle; $article->topic = "hello"; $article->text = "talk talk talk"; - + $comment = new CmsComment; $comment->topic = "good!"; $comment->text = "stuff!"; $comment->article = $article; - + $this->_em->persist($article); $this->_em->persist($comment); $this->_em->flush(); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php index 1d9de5334..599218b07 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php @@ -26,7 +26,7 @@ class DDC832Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC832Like'), )); } catch(\Exception $e) { - + } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC849Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC849Test.php index 45ff132cd..b17e60566 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC849Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC849Test.php @@ -13,71 +13,71 @@ class DDC849Test extends \Doctrine\Tests\OrmFunctionalTestCase private $user; private $group1; private $group2; - + public function setUp() { $this->useModelSet('cms'); parent::setUp(); - + $this->user = new CmsUser(); $this->user->username = "beberlei"; $this->user->name = "Benjamin"; $this->user->status = "active"; - + $this->group1 = new CmsGroup(); $this->group1->name = "Group 1"; $this->group2 = new CmsGroup(); $this->group2->name = "Group 2"; - + $this->user->addGroup($this->group1); $this->user->addGroup($this->group2); - + $this->_em->persist($this->user); $this->_em->persist($this->group1); $this->_em->persist($this->group2); - + $this->_em->flush(); $this->_em->clear(); - + $this->user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->user->getId()); } - + public function testRemoveContains() { $group1 = $this->user->groups[0]; $group2 = $this->user->groups[1]; - + $this->assertTrue($this->user->groups->contains($group1)); $this->assertTrue($this->user->groups->contains($group2)); - + $this->user->groups->removeElement($group1); $this->user->groups->remove(1); - + $this->assertFalse($this->user->groups->contains($group1)); $this->assertFalse($this->user->groups->contains($group2)); } - + public function testClearCount() { $this->user->addGroup(new CmsGroup); $this->assertEquals(3, count($this->user->groups)); - + $this->user->groups->clear(); - + $this->assertEquals(0, $this->user->groups->count()); $this->assertEquals(0, count($this->user->groups)); } - + public function testClearContains() { $group1 = $this->user->groups[0]; $group2 = $this->user->groups[1]; - + $this->assertTrue($this->user->groups->contains($group1)); $this->assertTrue($this->user->groups->contains($group2)); - + $this->user->groups->clear(); - + $this->assertFalse($this->user->groups->contains($group1)); $this->assertFalse($this->user->groups->contains($group2)); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php index fc43c207a..4ef3c08fa 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php @@ -18,7 +18,7 @@ class DDC881Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC881Phonecall'), )); } catch (\Exception $e) { - + } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php index 759a593fd..1ca35115d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php @@ -58,7 +58,7 @@ class AdvancedAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCase { $relation2->setParent($lemma1); $relation2->setChild($lemma3); $relation2->setType($type1); - + $relation3 = new Relation; $relation3->setParent($lemma1); $relation3->setChild($lemma4); diff --git a/tests/Doctrine/Tests/ORM/Functional/TypeValueSqlTest.php b/tests/Doctrine/Tests/ORM/Functional/TypeValueSqlTest.php index 5a05d76d2..1bd5184d0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/TypeValueSqlTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/TypeValueSqlTest.php @@ -36,9 +36,9 @@ class TypeValueSqlTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->persist($entity); $this->_em->flush(); - + $id = $entity->id; - + $this->_em->clear(); $entity = $this->_em->find('\Doctrine\Tests\Models\CustomType\CustomTypeUpperCase', $id); diff --git a/tests/Doctrine/Tests/ORM/Hydration/ResultSetMappingTest.php b/tests/Doctrine/Tests/ORM/Hydration/ResultSetMappingTest.php index d18c4dbb7..785c19b74 100644 --- a/tests/Doctrine/Tests/ORM/Hydration/ResultSetMappingTest.php +++ b/tests/Doctrine/Tests/ORM/Hydration/ResultSetMappingTest.php @@ -18,7 +18,7 @@ class ResultSetMappingTest extends \Doctrine\Tests\OrmTestCase * @var ResultSetMapping */ private $_rsm; - + /** * @var \Doctrine\ORM\EntityManager */ @@ -63,16 +63,16 @@ class ResultSetMappingTest extends \Doctrine\Tests\OrmTestCase $this->assertEquals('username', $this->_rsm->getFieldName('username')); $this->assertEquals('name', $this->_rsm->getFieldName('name')); } - + /** * @group DDC-1057 - * + * * Fluent interface test, not a real result set mapping */ public function testFluentInterface() { $rms = $this->_rsm; - + $rms->addEntityResult('Doctrine\Tests\Models\CMS\CmsUser','u') ->addJoinedEntityResult('Doctrine\Tests\Models\CMS\CmsPhonenumber','p','u','phonenumbers') ->addFieldResult('u', 'id', 'id') @@ -83,8 +83,8 @@ class ResultSetMappingTest extends \Doctrine\Tests\OrmTestCase ->addIndexByScalar('sclr0') ->addScalarResult('sclr0', 'numPhones') ->addMetaResult('a', 'user_id', 'user_id'); - - + + $this->assertTrue($rms->hasIndexBy('id')); $this->assertTrue($rms->isFieldResult('id')); $this->assertTrue($rms->isFieldResult('name')); diff --git a/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php b/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php index 6a645d8b0..3a009e5ea 100644 --- a/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php @@ -36,14 +36,14 @@ class AssignedGeneratorTest extends \Doctrine\Tests\OrmTestCase $this->fail('Assigned generator did not throw exception even though ID was missing.'); } catch (\Doctrine\ORM\ORMException $expected) {} } - + public function testCorrectIdGeneration() { $entity = new AssignedSingleIdEntity; $entity->myId = 1; $id = $this->_assignedGen->generate($this->_em, $entity); $this->assertEquals(array('myId' => 1), $id); - + $entity = new AssignedCompositeIdEntity; $entity->myId2 = 2; $entity->myId1 = 4; diff --git a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php index 2499d4eb6..330955a6f 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php @@ -373,22 +373,22 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase $this->assertEquals(ClassMetadataInfo::GENERATOR_TYPE_NONE, $class->generatorType); } - + /** * @group DDC-1170 */ public function testIdentifierColumnDefinition() { - + $class = $this->createClassMetadata(__NAMESPACE__ . '\DDC1170Entity'); - + $this->assertArrayHasKey('id', $class->fieldMappings); $this->assertArrayHasKey('value', $class->fieldMappings); - + $this->assertArrayHasKey('columnDefinition', $class->fieldMappings['id']); $this->assertArrayHasKey('columnDefinition', $class->fieldMappings['value']); - + $this->assertEquals("INT unsigned NOT NULL", $class->fieldMappings['id']['columnDefinition']); $this->assertEquals("VARCHAR(255) NOT NULL", $class->fieldMappings['value']['columnDefinition']); } @@ -626,13 +626,13 @@ class DDC1170Entity { /** - * @param string $value + * @param string $value */ function __construct($value = null) { $this->value = $value; } - + /** * @Id * @GeneratedValue(strategy="NONE") @@ -644,7 +644,7 @@ class DDC1170Entity * @Column(columnDefinition = "VARCHAR(255) NOT NULL") */ private $value; - + /** * @return integer */ @@ -660,7 +660,7 @@ class DDC1170Entity { return $this->value; } - + public static function loadMetadata(ClassMetadataInfo $metadata) { $metadata->mapField(array( diff --git a/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php index 9273f7c6b..dae4cd27a 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php @@ -146,7 +146,7 @@ class AnnotationDriverTest extends AbstractMappingDriverTest "mapped superclass 'Doctrine\Tests\ORM\Mapping\InvalidMappedSuperClass#users'"); $usingInvalidMsc = $factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\UsingInvalidMappedSuperClass'); } - + /** * @group DDC-1050 */ @@ -164,39 +164,39 @@ class AnnotationDriverTest extends AbstractMappingDriverTest "superclass 'Doctrine\Tests\ORM\Mapping\MappedSuperClassInheritence'."); $usingInvalidMsc = $factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\MappedSuperClassInheritence'); } - + /** * @group DDC-1034 */ public function testInheritanceSkipsParentLifecycleCallbacks() { $annotationDriver = $this->_loadDriver(); - + $cm = new ClassMetadata('Doctrine\Tests\ORM\Mapping\AnnotationChild'); $em = $this->_getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($annotationDriver); $factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory(); $factory->setEntityManager($em); - + $cm = $factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\AnnotationChild'); $this->assertEquals(array("postLoad" => array("postLoad"), "preUpdate" => array("preUpdate")), $cm->lifecycleCallbacks); - + $cm = $factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\AnnotationParent'); $this->assertEquals(array("postLoad" => array("postLoad"), "preUpdate" => array("preUpdate")), $cm->lifecycleCallbacks); } - + /** * @group DDC-1156 */ public function testMappedSuperclassInMiddleOfInheritanceHierachy() { $annotationDriver = $this->_loadDriver(); - + $em = $this->_getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($annotationDriver); $factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory(); $factory->setEntityManager($em); - + $cm = $factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\ChildEntity'); } @@ -253,7 +253,7 @@ class UsingInvalidMappedSuperClass extends InvalidMappedSuperClass */ class MappedSuperClassInheritence { - + } /** @@ -268,21 +268,21 @@ class AnnotationParent * @Id @Column(type="integer") @GeneratedValue */ private $id; - + /** * @PostLoad */ public function postLoad() { - + } - + /** * @PreUpdate */ public function preUpdate() { - + } } @@ -292,7 +292,7 @@ class AnnotationParent */ class AnnotationChild extends AnnotationParent { - + } /** diff --git a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php index 1d8d6c118..dfaf8c19a 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php @@ -10,12 +10,12 @@ require_once __DIR__ . '/../../TestInit.php'; class BasicInheritanceMappingTest extends \Doctrine\Tests\OrmTestCase { private $_factory; - + protected function setUp() { $this->_factory = new ClassMetadataFactory(); $this->_factory->setEntityManager($this->_getTestEntityManager()); } - + /** * @expectedException Doctrine\ORM\Mapping\MappingException */ @@ -23,60 +23,60 @@ class BasicInheritanceMappingTest extends \Doctrine\Tests\OrmTestCase { $this->_factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\TransientBaseClass'); } - + public function testGetMetadataForSubclassWithTransientBaseClass() { $class = $this->_factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\EntitySubClass'); - + $this->assertTrue(empty($class->subClasses)); $this->assertTrue(empty($class->parentClasses)); $this->assertTrue(isset($class->fieldMappings['id'])); $this->assertTrue(isset($class->fieldMappings['name'])); } - + public function testGetMetadataForSubclassWithMappedSuperclass() { $class = $this->_factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\EntitySubClass2'); - + $this->assertTrue(empty($class->subClasses)); $this->assertTrue(empty($class->parentClasses)); - + $this->assertTrue(isset($class->fieldMappings['mapped1'])); $this->assertTrue(isset($class->fieldMappings['mapped2'])); $this->assertTrue(isset($class->fieldMappings['id'])); $this->assertTrue(isset($class->fieldMappings['name'])); - + $this->assertFalse(isset($class->fieldMappings['mapped1']['inherited'])); $this->assertFalse(isset($class->fieldMappings['mapped2']['inherited'])); $this->assertFalse(isset($class->fieldMappings['transient'])); - + $this->assertTrue(isset($class->associationMappings['mappedRelated1'])); } - + /** * @group DDC-869 */ public function testGetMetadataForSubclassWithMappedSuperclassWhithRepository() { $class = $this->_factory->getMetadataFor('Doctrine\Tests\Models\DDC869\DDC869CreditCardPayment'); - + $this->assertTrue(isset($class->fieldMappings['id'])); $this->assertTrue(isset($class->fieldMappings['value'])); $this->assertTrue(isset($class->fieldMappings['creditCardNumber'])); $this->assertEquals($class->customRepositoryClassName, "Doctrine\Tests\Models\DDC869\DDC869PaymentRepository"); - - + + $class = $this->_factory->getMetadataFor('Doctrine\Tests\Models\DDC869\DDC869ChequePayment'); - + $this->assertTrue(isset($class->fieldMappings['id'])); $this->assertTrue(isset($class->fieldMappings['value'])); $this->assertTrue(isset($class->fieldMappings['serialNumber'])); $this->assertEquals($class->customRepositoryClassName, "Doctrine\Tests\Models\DDC869\DDC869PaymentRepository"); - - + + // override repositoryClass $class = $this->_factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\SubclassWithRepository'); - + $this->assertTrue(isset($class->fieldMappings['id'])); $this->assertTrue(isset($class->fieldMappings['value'])); $this->assertEquals($class->customRepositoryClassName, "Doctrine\ORM\EntityRepository"); @@ -96,29 +96,29 @@ class BasicInheritanceMappingTest extends \Doctrine\Tests\OrmTestCase $this->assertTrue(isset($class2->reflFields['mapped2'])); $this->assertTrue(isset($class2->reflFields['mappedRelated1'])); } - + /** * @group DDC-1203 */ public function testUnmappedSuperclassInHierachy() { $class = $this->_factory->getMetadataFor(__NAMESPACE__ . '\\HierachyD'); - + $this->assertTrue(isset($class->fieldMappings['id'])); $this->assertTrue(isset($class->fieldMappings['a'])); $this->assertTrue(isset($class->fieldMappings['d'])); } - + /** * @group DDC-1204 */ public function testUnmappedEntityInHierachy() { $this->setExpectedException('Doctrine\ORM\Mapping\MappingException', "Entity 'Doctrine\Tests\ORM\Mapping\HierachyBEntity' has to be part of the discriminator map of 'Doctrine\Tests\ORM\Mapping\HierachyBase' to be properly mapped in the inheritance hierachy. Alternatively you can make 'Doctrine\Tests\ORM\Mapping\HierachyBEntity' an abstract class to avoid this exception from occuring."); - + $class = $this->_factory->getMetadataFor(__NAMESPACE__ . '\\HierachyE'); } - + /** * @group DDC-1204 * @group DDC-1203 @@ -126,10 +126,10 @@ class BasicInheritanceMappingTest extends \Doctrine\Tests\OrmTestCase public function testMappedSuperclassWithId() { $class = $this->_factory->getMetadataFor(__NAMESPACE__ . '\\SuperclassEntity'); - + $this->assertTrue(isset($class->fieldMappings['id'])); } - + /** * @group DDC-1156 * @group DDC-1218 @@ -138,11 +138,11 @@ class BasicInheritanceMappingTest extends \Doctrine\Tests\OrmTestCase { $class = $this->_factory->getMetadataFor(__NAMESPACE__ . '\\SuperclassEntity'); /* @var $class ClassMetadataInfo */ - + $this->assertInstanceOf('Doctrine\ORM\Id\SequenceGenerator', $class->idGenerator); $this->assertEquals(array('allocationSize' => 1, 'initialValue' => 10, 'sequenceName' => 'foo'), $class->sequenceGeneratorDefinition); } - + /** * @group DDC-1156 * @group DDC-1218 @@ -151,11 +151,11 @@ class BasicInheritanceMappingTest extends \Doctrine\Tests\OrmTestCase { $class = $this->_factory->getMetadataFor(__NAMESPACE__ . '\\HierachyD'); /* @var $class ClassMetadataInfo */ - + $this->assertInstanceOf('Doctrine\ORM\Id\SequenceGenerator', $class->idGenerator); $this->assertEquals(array('allocationSize' => 1, 'initialValue' => 10, 'sequenceName' => 'foo'), $class->sequenceGeneratorDefinition); } - + /** * @group DDC-1156 * @group DDC-1218 @@ -164,7 +164,7 @@ class BasicInheritanceMappingTest extends \Doctrine\Tests\OrmTestCase { $class = $this->_factory->getMetadataFor(__NAMESPACE__ . '\\MediumSuperclassEntity'); /* @var $class ClassMetadataInfo */ - + $this->assertInstanceOf('Doctrine\ORM\Id\SequenceGenerator', $class->idGenerator); $this->assertEquals(array('allocationSize' => 1, 'initialValue' => 10, 'sequenceName' => 'foo'), $class->sequenceGeneratorDefinition); } @@ -285,7 +285,7 @@ class SuperclassEntity extends SuperclassBase abstract class SuperclassBase { /** - * @Column(type="integer") @Id @GeneratedValue(strategy="SEQUENCE") + * @Column(type="integer") @Id @GeneratedValue(strategy="SEQUENCE") * @SequenceGenerator(sequenceName="foo", initialValue=10) * @var int */ @@ -297,7 +297,7 @@ abstract class SuperclassBase */ abstract class MediumSuperclassBase extends SuperclassBase { - + } /** @@ -305,7 +305,7 @@ abstract class MediumSuperclassBase extends SuperclassBase */ class MediumSuperclassEntity extends MediumSuperclassBase { - + } /** @@ -313,5 +313,5 @@ class MediumSuperclassEntity extends MediumSuperclassBase */ class SubclassWithRepository extends \Doctrine\Tests\Models\DDC869\DDC869Payment { - + } \ No newline at end of file diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php index 00b8f5f16..252428399 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php @@ -82,7 +82,7 @@ class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase $this->assertFalse($h2); $this->assertTrue($h1); } - + /** * @group DDC-1512 */ @@ -98,13 +98,13 @@ class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase ->method('isTransient') ->with($this->equalTo('Doctrine\Tests\Models\CMS\CmsArticle')) ->will($this->returnValue(false)); - + $em = $this->_createEntityManager($driver); - + $this->assertTrue($em->getMetadataFactory()->isTransient('Doctrine\Tests\Models\CMS\CmsUser')); $this->assertFalse($em->getMetadataFactory()->isTransient('Doctrine\Tests\Models\CMS\CmsArticle')); } - + /** * @group DDC-1512 */ @@ -120,10 +120,10 @@ class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase ->method('isTransient') ->with($this->equalTo('Doctrine\Tests\Models\CMS\CmsArticle')) ->will($this->returnValue(false)); - + $em = $this->_createEntityManager($driver); $em->getConfiguration()->addEntityNamespace('CMS', 'Doctrine\Tests\Models\CMS'); - + $this->assertTrue($em->getMetadataFactory()->isTransient('CMS:CmsUser')); $this->assertFalse($em->getMetadataFactory()->isTransient('CMS:CmsArticle')); } diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataLoadEventTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataLoadEventTest.php index 64357cf99..5ef67c3eb 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataLoadEventTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataLoadEventTest.php @@ -6,7 +6,7 @@ use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Events; require_once __DIR__ . '/../../TestInit.php'; - + class ClassMetadataLoadEventTest extends \Doctrine\Tests\OrmTestCase { public function testEvent() diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php index 55726e387..fb43eeae7 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php @@ -7,7 +7,7 @@ use Doctrine\ORM\Events; require_once __DIR__ . '/../../TestInit.php'; require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php'; - + class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase { public function testClassMetadataInstanceSerialization() @@ -94,7 +94,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase $this->assertEquals("DoctrineGlobal_User", $cm->associationMappings['author']['targetEntity']); } - + public function testMapManyToManyJoinTableDefaults() { $cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser'); @@ -103,7 +103,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase 'fieldName' => 'groups', 'targetEntity' => 'CmsGroup' )); - + $assoc = $cm->associationMappings['groups']; //$this->assertInstanceOf('Doctrine\ORM\Mapping\ManyToManyMapping', $assoc); $this->assertEquals(array( @@ -236,7 +236,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase $this->setExpectedException('Doctrine\ORM\Mapping\MappingException'); $cm->mapField(array('fieldName' => 'name', 'columnName' => 'name')); } - + /** * @group DDC-1224 */ @@ -244,7 +244,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase { $cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser'); $cm->setTableName('foo.bar'); - + $this->assertEquals('foo_bar_id_tmp', $cm->getTemporaryIdTableName()); } diff --git a/tests/Doctrine/Tests/ORM/Mapping/DriverChainTest.php b/tests/Doctrine/Tests/ORM/Mapping/DriverChainTest.php index dc8bc695d..2383db64c 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/DriverChainTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/DriverChainTest.php @@ -45,7 +45,7 @@ class DriverChainTest extends \Doctrine\Tests\OrmTestCase $classMetadata = new \Doctrine\ORM\Mapping\ClassMetadata($className); $chain = new DriverChain(); - + $this->setExpectedException('Doctrine\ORM\Mapping\MappingException'); $chain->loadMetadataForClass($className, $classMetadata); } @@ -81,7 +81,7 @@ class DriverChainTest extends \Doctrine\Tests\OrmTestCase * @group DDC-706 */ public function testIsTransient() - { + { $chain = new DriverChain(); $chain->addDriver($this->createAnnotationDriver(), 'Doctrine\Tests\Models\CMS'); @@ -92,5 +92,5 @@ class DriverChainTest extends \Doctrine\Tests\OrmTestCase class DriverChainEntity { - + } \ No newline at end of file diff --git a/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php index 980a720df..e04543db0 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php @@ -53,7 +53,7 @@ class XmlMappingDriverTest extends AbstractMappingDriverTest /** * @group DDC-1468 - * + * * @expectedException Doctrine\ORM\Mapping\MappingException * @expectedExceptionMessage Invalid mapping file 'Doctrine.Tests.Models.Generic.SerializationModel.dcm.xml' for class 'Doctrine\Tests\Models\Generic\SerializationModel'. */ 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 2039578a3..33020aa6b 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 @@ -38,15 +38,15 @@ $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO); $metadata->mapOneToOne(array( 'fieldName' => 'address', 'targetEntity' => 'Doctrine\\Tests\\ORM\\Mapping\\Address', - 'cascade' => + 'cascade' => array( 0 => 'remove', ), 'mappedBy' => NULL, 'inversedBy' => 'user', - 'joinColumns' => + 'joinColumns' => array( - 0 => + 0 => array( 'name' => 'address_id', 'referencedColumnName' => 'id', @@ -58,13 +58,13 @@ $metadata->mapOneToOne(array( $metadata->mapOneToMany(array( 'fieldName' => 'phonenumbers', 'targetEntity' => 'Doctrine\\Tests\\ORM\\Mapping\\Phonenumber', - 'cascade' => + 'cascade' => array( 1 => 'persist', ), 'mappedBy' => 'user', 'orphanRemoval' => true, - 'orderBy' => + 'orderBy' => array( 'number' => 'ASC', ), @@ -72,7 +72,7 @@ $metadata->mapOneToMany(array( $metadata->mapManyToMany(array( 'fieldName' => 'groups', 'targetEntity' => 'Doctrine\\Tests\\ORM\\Mapping\\Group', - 'cascade' => + 'cascade' => array( 0 => 'remove', 1 => 'persist', @@ -81,12 +81,12 @@ $metadata->mapManyToMany(array( 4 => 'detach', ), 'mappedBy' => NULL, - 'joinTable' => + 'joinTable' => array( 'name' => 'cms_users_groups', - 'joinColumns' => + 'joinColumns' => array( - 0 => + 0 => array( 'name' => 'user_id', 'referencedColumnName' => 'id', @@ -94,9 +94,9 @@ $metadata->mapManyToMany(array( 'nullable' => false, ), ), - 'inverseJoinColumns' => + 'inverseJoinColumns' => array( - 0 => + 0 => array( 'name' => 'group_id', 'referencedColumnName' => 'id', diff --git a/tests/Doctrine/Tests/ORM/Performance/HydrationPerformanceTest.php b/tests/Doctrine/Tests/ORM/Performance/HydrationPerformanceTest.php index 01f02c0d9..07a202e4a 100644 --- a/tests/Doctrine/Tests/ORM/Performance/HydrationPerformanceTest.php +++ b/tests/Doctrine/Tests/ORM/Performance/HydrationPerformanceTest.php @@ -76,7 +76,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase $e = microtime(true); echo __FUNCTION__ . " - " . ($e - $s) . " seconds" . PHP_EOL; } - + /** * Times for comparison: * @@ -264,7 +264,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase $e = microtime(true); echo __FUNCTION__ . " - " . ($e - $s) . " seconds" . PHP_EOL; } - + /** * [romanb: 10000 rows => 3 seconds] * @@ -392,7 +392,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase $e = microtime(true); echo __FUNCTION__ . " - " . ($e - $s) . " seconds" . PHP_EOL; } - + /** * [romanb: 2000 rows => 0.6 seconds] * diff --git a/tests/Doctrine/Tests/ORM/Performance/InsertPerformanceTest.php b/tests/Doctrine/Tests/ORM/Performance/InsertPerformanceTest.php index cccc480a2..1c378df6d 100644 --- a/tests/Doctrine/Tests/ORM/Performance/InsertPerformanceTest.php +++ b/tests/Doctrine/Tests/ORM/Performance/InsertPerformanceTest.php @@ -31,7 +31,7 @@ class InsertPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase $this->setMaxRunningTime(10); //echo "Memory usage before: " . (memory_get_usage() / 1024) . " KB" . PHP_EOL; - + $batchSize = 20; for ($i=1; $i<=10000; ++$i) { $user = new CmsUser; @@ -44,13 +44,13 @@ class InsertPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase $this->_em->clear(); } } - + //gc_collect_cycles(); //echo "Memory usage after: " . (memory_get_usage() / 1024) . " KB" . PHP_EOL; $e = microtime(true); - echo ' Inserted 10000 objects in ' . ($e - $s) . ' seconds' . PHP_EOL; + echo ' Inserted 10000 objects in ' . ($e - $s) . ' seconds' . PHP_EOL; } } diff --git a/tests/Doctrine/Tests/ORM/Performance/UnitOfWorkPerformanceTest.php b/tests/Doctrine/Tests/ORM/Performance/UnitOfWorkPerformanceTest.php index 650228ba4..932082813 100644 --- a/tests/Doctrine/Tests/ORM/Performance/UnitOfWorkPerformanceTest.php +++ b/tests/Doctrine/Tests/ORM/Performance/UnitOfWorkPerformanceTest.php @@ -35,7 +35,7 @@ class UnitOfWorkPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase } $this->_em->flush(); - + foreach ($users AS $user) { $user->status = 'other'; $user->username = $user->username . '++'; diff --git a/tests/Doctrine/Tests/ORM/PersistentCollectionTest.php b/tests/Doctrine/Tests/ORM/PersistentCollectionTest.php index 47eeb8b9a..fd0dffbf2 100644 --- a/tests/Doctrine/Tests/ORM/PersistentCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/PersistentCollectionTest.php @@ -18,7 +18,7 @@ class PersistentCollectionTest extends \Doctrine\Tests\OrmTestCase { private $_connectionMock; private $_emMock; - + protected function setUp() { parent::setUp(); diff --git a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php index 04c47893d..d1fe9a6b5 100644 --- a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php +++ b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php @@ -18,13 +18,13 @@ class BasicEntityPersisterTypeValueSqlTest extends \Doctrine\Tests\OrmTestCase protected function setUp() { parent::setUp(); - + if (DBALType::hasType('negative_to_positive')) { DBALType::overrideType('negative_to_positive', '\Doctrine\Tests\DbalTypes\NegativeToPositiveType'); } else { DBALType::addType('negative_to_positive', '\Doctrine\Tests\DbalTypes\NegativeToPositiveType'); } - + if (DBALType::hasType('upper_case_string')) { DBALType::overrideType('upper_case_string', '\Doctrine\Tests\DbalTypes\UpperCaseStringType'); } else { diff --git a/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php b/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php index cf9575869..2305287a4 100644 --- a/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php +++ b/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php @@ -23,7 +23,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase if ($debug) { echo $e->getTraceAsString() . PHP_EOL; } - + $this->fail($e->getMessage()); } } @@ -32,7 +32,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase { try { $parserResult = $this->parseDql($dql); - + $this->fail('No syntax errors were detected, when syntax errors were expected'); } catch (QueryException $e) { if ($debug) { @@ -41,25 +41,25 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase } } } - + public function parseDql($dql, $hints = array()) { $query = $this->_em->createQuery($dql); $query->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true); $query->setDql($dql); - + foreach ($hints as $key => $value) { $query->setHint($key, $value); } - + $parser = new \Doctrine\ORM\Query\Parser($query); - + // We do NOT test SQL output here. That only unnecessarily slows down the tests! $parser->setCustomOutputTreeWalker('Doctrine\Tests\Mocks\MockTreeWalker'); - + return $parser->parse(); } - + public function testEmptyQueryString() { $this->assertInvalidDQL(''); @@ -99,7 +99,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase { $this->assertValidDQL('SELECT COUNT(u.id) FROM Doctrine\Tests\Models\CMS\CmsUser u'); } - + public function testDuplicatedAliasInAggregateFunction() { $this->assertInvalidDQL('SELECT COUNT(u.id) AS num, SUM(u.id) AS num FROM Doctrine\Tests\Models\CMS\CmsUser u'); @@ -119,12 +119,12 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase { $this->assertValidDQL('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE ((u.id + 5000) * u.id + 3) < 10000000'); } - + public function testInExpressionSupportedInWherePart() { $this->assertValidDQL('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id IN (1, 2)'); } - + public function testInExpressionWithoutSpacesSupportedInWherePart() { $this->assertValidDQL('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id IN (1,2,3)'); @@ -159,7 +159,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase { $this->assertValidDQL('SELECT u FROM Doctrine\Tests\Models\Company\CompanyPerson u WHERE u NOT INSTANCE OF ?1'); } - + public function testExistsExpressionSupportedInWherePart() { $this->assertValidDQL('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE EXISTS (SELECT p.phonenumber FROM Doctrine\Tests\Models\CMS\CmsPhonenumber p WHERE p.phonenumber = 1234)'); @@ -332,7 +332,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase { $this->assertInvalidDQL("SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE id = 1"); } - + public function testDuplicatedAliasDeclaration() { $this->assertInvalidDQL("SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u INNER JOIN u.articles u WHERE u.id = 1"); @@ -425,58 +425,58 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase $this->assertValidDQL('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE :param MEMBER OF u.phonenumbers'); //$this->assertValidDQL("SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE 'Joe' MEMBER OF u.nicknames"); } - + public function testSizeFunction() { $this->assertValidDQL('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE SIZE(u.phonenumbers) > 1'); } - + public function testEmptyCollectionComparisonExpression() { $this->assertValidDQL('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.phonenumbers IS EMPTY'); } - + public function testSingleValuedAssociationFieldInWhere() { $this->assertValidDQL('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.address = ?1'); $this->assertValidDQL('SELECT p FROM Doctrine\Tests\Models\CMS\CmsPhonenumber p WHERE p.user = ?1'); } - + public function testBooleanLiteralInWhere() { $this->assertValidDQL('SELECT b FROM Doctrine\Tests\Models\Generic\BooleanModel b WHERE b.booleanField = true'); } - + public function testSubqueryInSelectExpression() { $this->assertValidDQL('select u, (select max(p.phonenumber) from Doctrine\Tests\Models\CMS\CmsPhonenumber p) maxId from Doctrine\Tests\Models\CMS\CmsUser u'); } - + public function testUsageOfQComponentOutsideSubquery() { $this->assertInvalidDQL('select u, (select max(p.phonenumber) from Doctrine\Tests\Models\CMS\CmsPhonenumber p) maxId from Doctrine\Tests\Models\CMS\CmsUser u WHERE p.user = ?1'); } - + public function testUnknownAbstractSchemaName() { $this->assertInvalidDQL('SELECT u FROM UnknownClassName u'); } - + public function testCorrectPartialObjectLoad() { $this->assertValidDQL('SELECT PARTIAL u.{id,name} FROM Doctrine\Tests\Models\CMS\CmsUser u'); } - + public function testIncorrectPartialObjectLoadBecauseOfMissingIdentifier() { $this->assertInvalidDQL('SELECT PARTIAL u.{name} FROM Doctrine\Tests\Models\CMS\CmsUser u'); } - + public function testScalarExpressionInSelect() { $this->assertValidDQL('SELECT u, 42 + u.id AS someNumber FROM Doctrine\Tests\Models\CMS\CmsUser u'); } - + public function testInputParameterInSelect() { $this->assertValidDQL('SELECT u, u.id + ?1 AS someNumber FROM Doctrine\Tests\Models\CMS\CmsUser u'); @@ -514,7 +514,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase $this->assertInvalidDQL('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.address = ?1'); } */ - + /** * @group DDC-617 */ @@ -570,12 +570,12 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase { $this->assertValidDQL("SELECT e, t FROM Doctrine\Tests\Models\DDC117\DDC117Editor e JOIN e.reviewingTranslations t WHERE SIZE(e.reviewingTranslations) > 0"); } - + public function testCaseSupportContainingNullIfExpression() { $this->assertValidDQL("SELECT u.id, NULLIF(u.name, u.name) AS shouldBeNull FROM Doctrine\Tests\Models\CMS\CmsUser u"); } - + public function testCaseSupportContainingCoalesceExpression() { $this->assertValidDQL("select COALESCE(NULLIF(u.name, ''), u.username) as Display FROM Doctrine\Tests\Models\CMS\CmsUser u"); diff --git a/tests/Doctrine/Tests/ORM/Query/LexerTest.php b/tests/Doctrine/Tests/ORM/Query/LexerTest.php index f84669554..29bba4bae 100644 --- a/tests/Doctrine/Tests/ORM/Query/LexerTest.php +++ b/tests/Doctrine/Tests/ORM/Query/LexerTest.php @@ -16,7 +16,7 @@ class LexerTest extends \Doctrine\Tests\OrmTestCase public function testScannerRecognizesIdentifierWithLengthOfOneCharacter() { $lexer = new Lexer('u'); - + $lexer->moveNext(); $token = $lexer->lookahead; diff --git a/tests/Doctrine/Tests/ORM/QueryBuilderTest.php b/tests/Doctrine/Tests/ORM/QueryBuilderTest.php index 2b352bdce..93af68ae6 100644 --- a/tests/Doctrine/Tests/ORM/QueryBuilderTest.php +++ b/tests/Doctrine/Tests/ORM/QueryBuilderTest.php @@ -120,7 +120,7 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase $this->assertValidQueryBuilder($qb, 'SELECT u, a FROM Doctrine\Tests\Models\CMS\CmsUser u INNER JOIN u.articles a'); } - + public function testComplexInnerJoin() { $qb = $this->_em->createQueryBuilder() @@ -129,7 +129,7 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase ->innerJoin('u.articles', 'a', 'ON', 'u.id = a.author_id'); $this->assertValidQueryBuilder( - $qb, + $qb, 'SELECT u, a FROM Doctrine\Tests\Models\CMS\CmsUser u INNER JOIN u.articles a ON u.id = a.author_id' ); } @@ -153,17 +153,17 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase $this->assertValidQueryBuilder($qb, 'SELECT u, a FROM Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a INDEX BY a.name'); } - + public function testMultipleFrom() { $qb = $this->_em->createQueryBuilder() ->select('u', 'g') ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') ->from('Doctrine\Tests\Models\CMS\CmsGroup', 'g'); - + $this->assertValidQueryBuilder($qb, 'SELECT u, g FROM Doctrine\Tests\Models\CMS\CmsUser u, Doctrine\Tests\Models\CMS\CmsGroup g'); } - + public function testMultipleFromWithJoin() { $qb = $this->_em->createQueryBuilder() @@ -171,10 +171,10 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') ->from('Doctrine\Tests\Models\CMS\CmsGroup', 'g') ->innerJoin('u.articles', 'a', 'ON', 'u.id = a.author_id'); - + $this->assertValidQueryBuilder($qb, 'SELECT u, g FROM Doctrine\Tests\Models\CMS\CmsUser u INNER JOIN u.articles a ON u.id = a.author_id, Doctrine\Tests\Models\CMS\CmsGroup g'); } - + public function testMultipleFromWithMultipleJoin() { $qb = $this->_em->createQueryBuilder() @@ -184,7 +184,7 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase ->innerJoin('u.groups', 'g') ->leftJoin('u.address', 'ad') ->innerJoin('a.comments', 'c'); - + $this->assertValidQueryBuilder($qb, 'SELECT u, g FROM Doctrine\Tests\Models\CMS\CmsUser u INNER JOIN u.groups g LEFT JOIN u.address ad, Doctrine\Tests\Models\CMS\CmsArticle a INNER JOIN a.comments c'); } @@ -197,7 +197,7 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid'); } - + public function testComplexAndWhere() { $qb = $this->_em->createQueryBuilder() @@ -205,7 +205,7 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') ->where('u.id = :uid OR u.id = :uid2 OR u.id = :uid3') ->andWhere('u.name = :name'); - + $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE (u.id = :uid OR u.id = :uid2 OR u.id = :uid3) AND u.name = :name'); } @@ -345,7 +345,7 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u ORDER BY u.username ASC'); } - + public function testOrderByWithExpression() { $qb = $this->_em->createQueryBuilder(); @@ -466,21 +466,21 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid3 OR u.id IN(1)'); } - + public function testWhereInWithStringLiterals() { $qb = $this->_em->createQueryBuilder(); $qb->select('u') ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') ->where($qb->expr()->in('u.name', array('one', 'two', 'three'))); - + $this->assertValidQueryBuilder($qb, "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name IN('one', 'two', 'three')"); - + $qb->where($qb->expr()->in('u.name', array("O'Reilly", "O'Neil", 'Smith'))); - + $this->assertValidQueryBuilder($qb, "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name IN('O''Reilly', 'O''Neil', 'Smith')"); } - + public function testWhereInWithObjectLiterals() { $qb = $this->_em->createQueryBuilder(); @@ -488,14 +488,14 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase $qb->select('u') ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') ->where($expr->in('u.name', array($expr->literal('one'), $expr->literal('two'), $expr->literal('three')))); - + $this->assertValidQueryBuilder($qb, "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name IN('one', 'two', 'three')"); - + $qb->where($expr->in('u.name', array($expr->literal("O'Reilly"), $expr->literal("O'Neil"), $expr->literal('Smith')))); - + $this->assertValidQueryBuilder($qb, "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name IN('O''Reilly', 'O''Neil', 'Smith')"); } - + public function testNegation() { $expr = $this->_em->getExpressionBuilder(); @@ -510,7 +510,7 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid3 OR NOT(u.id IN(1))'); } - + public function testSomeAllAny() { $qb = $this->_em->createQueryBuilder(); @@ -521,30 +521,30 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase $qb->select('u') ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') ->where($expr->gt('u.id', $expr->all('select a.id from Doctrine\Tests\Models\CMS\CmsArticle a'))); - + $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id > ALL(select a.id from Doctrine\Tests\Models\CMS\CmsArticle a)'); } - + public function testMultipleIsolatedQueryConstruction() { $qb = $this->_em->createQueryBuilder(); $expr = $this->_em->getExpressionBuilder(); - + $qb->select('u')->from('Doctrine\Tests\Models\CMS\CmsUser', 'u'); $qb->where($expr->eq('u.name', ':name')); $qb->setParameter('name', 'romanb'); - + $q1 = $qb->getQuery(); $this->assertEquals('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name = :name', $q1->getDql()); $this->assertEquals(1, count($q1->getParameters())); - + // add another condition and construct a second query $qb->andWhere($expr->eq('u.id', ':id')); $qb->setParameter('id', 42); - + $q2 = $qb->getQuery(); - + $this->assertEquals('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name = :name AND u.id = :id', $q2->getDql()); $this->assertTrue($q1 !== $q2); // two different, independent queries $this->assertEquals(2, count($q2->getParameters())); @@ -638,61 +638,61 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase $expr = $qb->getDQLPart('where'); $this->assertEquals(2, $expr->count(), "Modifying the second query should affect the first one."); - + $qb2 = clone $qb; $qb2->andWhere('u.name = ?3'); $this->assertEquals(2, $expr->count(), "Modifying the second query should affect the first one."); } - + public function testGetRootAlias() { $qb = $this->_em->createQueryBuilder() ->select('u') ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u'); - + $this->assertEquals('u', $qb->getRootAlias()); } - + public function testGetRootAliases() { $qb = $this->_em->createQueryBuilder() ->select('u') ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u'); - + $this->assertEquals(array('u'), $qb->getRootAliases()); } - + public function testGetRootEntities() { $qb = $this->_em->createQueryBuilder() ->select('u') ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u'); - + $this->assertEquals(array('Doctrine\Tests\Models\CMS\CmsUser'), $qb->getRootEntities()); } - + public function testGetSeveralRootAliases() { $qb = $this->_em->createQueryBuilder() ->select('u') ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u2'); - + $this->assertEquals(array('u', 'u2'), $qb->getRootAliases()); $this->assertEquals('u', $qb->getRootAlias()); } - + public function testBCAddJoinWithoutRootAlias() { $qb = $this->_em->createQueryBuilder() ->select('u') ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') ->add('join', array('INNER JOIN u.groups g'), true); - + $this->assertEquals('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u INNER JOIN u.groups g', $qb->getDQL()); } - + /** * @group DDC-1211 */ @@ -703,10 +703,10 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase ->select('u') ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') ->where($expr->eq('u.username', $expr->literal(""))); - + $this->assertEquals("SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = ''", $qb->getDQL()); } - + /** * @group DDC-1211 */ @@ -717,10 +717,10 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase ->select('u') ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') ->where($expr->eq('u.username', $expr->literal(0))); - + $this->assertEquals('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = 0', $qb->getDQL()); } - + /** * @group DDC-1227 */ @@ -729,7 +729,7 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase $qb = $this->_em->createQueryBuilder() ->add('select', 'u') ->add('from', 'Doctrine\Tests\Models\CMS\CmsUser u'); - + $this->assertEquals('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u', $qb->getDQL()); } } \ No newline at end of file diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php index f2b298159..faf20afb1 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php @@ -45,7 +45,7 @@ class EntityGeneratorTest extends \Doctrine\Tests\OrmTestCase $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorBook'); $metadata->namespace = $this->_namespace; $metadata->customRepositoryClassName = $this->_namespace . '\EntityGeneratorBookRepository'; - + $metadata->table['name'] = 'book'; $metadata->mapField(array('fieldName' => 'name', 'type' => 'string')); $metadata->mapField(array('fieldName' => 'status', 'type' => 'string', 'default' => 'published')); @@ -100,7 +100,7 @@ class EntityGeneratorTest extends \Doctrine\Tests\OrmTestCase $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getAuthor'), "EntityGeneratorBook::getAuthor() missing."); $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getComments'), "EntityGeneratorBook::getComments() missing."); $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'addEntityGeneratorComment'), "EntityGeneratorBook::addEntityGeneratorComment() missing."); - + $this->assertEquals('published', $book->getStatus()); $book->setName('Jonathan H. Wage'); @@ -120,7 +120,7 @@ class EntityGeneratorTest extends \Doctrine\Tests\OrmTestCase { $metadata = $this->generateBookEntityFixture(); $metadata->mapField(array('fieldName' => 'test', 'type' => 'string')); - + $this->_generator->writeEntityClass($metadata, $this->_tmpDir); $this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/EntityGeneratorBook.php~"); diff --git a/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php b/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php index 6ff3d1808..2267020e3 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php @@ -136,7 +136,7 @@ abstract class AbstractClassMetadataExporterTest extends \Doctrine\Tests\OrmTest public function testExportedMetadataCanBeReadBackIn() { $type = $this->_getType(); - + $metadataDriver = $this->_createMetadataDriver($type, __DIR__ . '/export/' . $type); $em = $this->_createEntityManager($metadataDriver); $cmf = $this->_createClassMetadataFactory($em, $type); @@ -145,7 +145,7 @@ abstract class AbstractClassMetadataExporterTest extends \Doctrine\Tests\OrmTest $this->assertEquals(1, count($metadata)); $class = current($metadata); - + $this->assertEquals('Doctrine\Tests\ORM\Tools\Export\ExportedUser', $class->name); return $class; @@ -251,7 +251,7 @@ abstract class AbstractClassMetadataExporterTest extends \Doctrine\Tests\OrmTest $this->assertTrue($class->associationMappings['phonenumbers']['isCascadeMerge']); $this->assertFalse($class->associationMappings['phonenumbers']['isCascadeDetach']); $this->assertTrue($class->associationMappings['phonenumbers']['orphanRemoval']); - + return $class; } @@ -339,14 +339,14 @@ abstract class AbstractClassMetadataExporterTest extends \Doctrine\Tests\OrmTest $this->assertEquals('cascade-all', $nodes[0]->getName()); } elseif ($type == 'yaml') { - + $yaml = new \Symfony\Component\Yaml\Parser(); $value = $yaml->parse(file_get_contents(__DIR__ . '/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.yml')); - + $this->assertTrue(isset($value['Doctrine\Tests\ORM\Tools\Export\ExportedUser']['oneToMany']['interests']['cascade'])); $this->assertEquals(1, count($value['Doctrine\Tests\ORM\Tools\Export\ExportedUser']['oneToMany']['interests']['cascade'])); $this->assertEquals('all', $value['Doctrine\Tests\ORM\Tools\Export\ExportedUser']['oneToMany']['interests']['cascade'][0]); - + } else { $this->markTestSkipped('Test aviable only for '.$type.' dirver'); } 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 c50d2a75b..f90f22071 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 @@ -35,14 +35,14 @@ $metadata->mapOneToOne(array( 'fieldName' => 'address', 'targetEntity' => 'Doctrine\\Tests\\ORM\\Tools\\Export\\Address', 'inversedBy' => 'user', - 'cascade' => + 'cascade' => array( 0 => 'persist', ), 'mappedBy' => NULL, - 'joinColumns' => + 'joinColumns' => array( - 0 => + 0 => array( 'name' => 'address_id', 'referencedColumnName' => 'id', @@ -54,14 +54,14 @@ $metadata->mapOneToOne(array( $metadata->mapOneToMany(array( 'fieldName' => 'phonenumbers', 'targetEntity' => 'Doctrine\\Tests\\ORM\\Tools\\Export\\Phonenumber', - 'cascade' => + 'cascade' => array( 1 => 'persist', 2 => 'merge', ), 'mappedBy' => 'user', 'orphanRemoval' => true, - 'orderBy' => + 'orderBy' => array( 'number' => 'ASC', ), @@ -69,7 +69,7 @@ $metadata->mapOneToMany(array( $metadata->mapManyToMany(array( 'fieldName' => 'groups', 'targetEntity' => 'Doctrine\\Tests\\ORM\\Tools\\Export\\Group', - 'cascade' => + 'cascade' => array( 0 => 'remove', 1 => 'persist', @@ -78,12 +78,12 @@ $metadata->mapManyToMany(array( 4 => 'detach', ), 'mappedBy' => NULL, - 'joinTable' => + 'joinTable' => array( 'name' => 'cms_users_groups', - 'joinColumns' => + 'joinColumns' => array( - 0 => + 0 => array( 'name' => 'user_id', 'referencedColumnName' => 'id', @@ -91,9 +91,9 @@ $metadata->mapManyToMany(array( 'nullable' => false, ), ), - 'inverseJoinColumns' => + 'inverseJoinColumns' => array( - 0 => + 0 => array( 'name' => 'group_id', 'referencedColumnName' => 'id', diff --git a/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php b/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php index b794474a8..3cb627f07 100644 --- a/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php @@ -79,7 +79,7 @@ class ResolveTargetEntity implements ResolveTargetInterface /** * @Id * @Column(type="integer") - * @GeneratedValue(strategy="AUTO") + * @GeneratedValue(strategy="AUTO") */ private $id; @@ -118,7 +118,7 @@ class TargetEntity implements TargetInterface /** * @Id * @Column(type="integer") - * @GeneratedValue(strategy="AUTO") + * @GeneratedValue(strategy="AUTO") */ private $id; diff --git a/tests/Doctrine/Tests/ORM/Tools/SetupTest.php b/tests/Doctrine/Tests/ORM/Tools/SetupTest.php index 643464df0..45c9e3ea7 100644 --- a/tests/Doctrine/Tests/ORM/Tools/SetupTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/SetupTest.php @@ -11,62 +11,62 @@ class SetupTest extends \Doctrine\Tests\OrmTestCase { private $originalAutoloaderCount; private $originalIncludePath; - + public function setUp() { if (strpos(\Doctrine\ORM\Version::VERSION, "DEV") === false) { $this->markTestSkipped("Test only runs in a dev-installation from Github"); } - + $this->originalAutoloaderCount = count(spl_autoload_functions()); $this->originalIncludePath = get_include_path(); } - + public function testGitAutoload() - { + { Setup::registerAutoloadGit(__DIR__ . "/../../../../../"); - + $this->assertEquals($this->originalAutoloaderCount + 4, count(spl_autoload_functions())); } - + public function testPEARAutoload() { set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . "/../../../../../lib/vendor/doctrine-common/lib"); - + Setup::registerAutoloadPEAR(); - + $this->assertEquals($this->originalAutoloaderCount + 2, count(spl_autoload_functions())); } - + public function testDirectoryAutoload() { Setup::registerAutoloadDirectory(__DIR__ . "/../../../../../lib/vendor/doctrine-common/lib"); - + $this->assertEquals($this->originalAutoloaderCount + 2, count(spl_autoload_functions())); } - + public function testAnnotationConfiguration() { $config = Setup::createAnnotationMetadataConfiguration(array(), true); - + $this->assertInstanceOf('Doctrine\ORM\Configuration', $config); $this->assertEquals(sys_get_temp_dir(), $config->getProxyDir()); $this->assertEquals('DoctrineProxies', $config->getProxyNamespace()); $this->assertInstanceOf('Doctrine\ORM\Mapping\Driver\AnnotationDriver', $config->getMetadataDriverImpl()); } - + public function testXMLConfiguration() { $config = Setup::createXMLMetadataConfiguration(array(), true); - + $this->assertInstanceOf('Doctrine\ORM\Configuration', $config); $this->assertInstanceOf('Doctrine\ORM\Mapping\Driver\XmlDriver', $config->getMetadataDriverImpl()); } - + public function testYAMLConfiguration() { $config = Setup::createYAMLMetadataConfiguration(array(), true); - + $this->assertInstanceOf('Doctrine\ORM\Configuration', $config); $this->assertInstanceOf('Doctrine\ORM\Mapping\Driver\YamlDriver', $config->getMetadataDriverImpl()); } @@ -87,12 +87,12 @@ class SetupTest extends \Doctrine\Tests\OrmTestCase { $cache = new ArrayCache(); $config = Setup::createAnnotationMetadataConfiguration(array(), true, null, $cache); - + $this->assertSame($cache, $config->getResultCacheImpl()); $this->assertSame($cache, $config->getMetadataCacheImpl()); $this->assertSame($cache, $config->getQueryCacheImpl()); } - + public function tearDown() { set_include_path($this->originalIncludePath); diff --git a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php index 5858b5a98..9cc20ad73 100644 --- a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php +++ b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php @@ -24,7 +24,7 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase private $_connectionMock; // The EntityManager mock that provides the mock persisters private $_emMock; - + protected function setUp() { parent::setUp(); $this->_connectionMock = new ConnectionMock(array(), new \Doctrine\Tests\Mocks\DriverMock()); @@ -33,22 +33,22 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase $this->_unitOfWork = new UnitOfWorkMock($this->_emMock); $this->_emMock->setUnitOfWork($this->_unitOfWork); } - + protected function tearDown() { } - + public function testRegisterRemovedOnNewEntityIsIgnored() { $user = new ForumUser(); $user->username = 'romanb'; $this->assertFalse($this->_unitOfWork->isScheduledForDelete($user)); $this->_unitOfWork->scheduleForDelete($user); - $this->assertFalse($this->_unitOfWork->isScheduledForDelete($user)); + $this->assertFalse($this->_unitOfWork->isScheduledForDelete($user)); } - - + + /* Operational tests */ - + public function testSavingSingleEntityWithIdentityColumnForcesInsert() { // Setup fake persister and id generator for identity generation @@ -66,22 +66,22 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase // Check $this->assertEquals(0, count($userPersister->getInserts())); $this->assertEquals(0, count($userPersister->getUpdates())); - $this->assertEquals(0, count($userPersister->getDeletes())); + $this->assertEquals(0, count($userPersister->getDeletes())); $this->assertFalse($this->_unitOfWork->isInIdentityMap($user)); // should no longer be scheduled for insert $this->assertTrue($this->_unitOfWork->isScheduledForInsert($user)); - + // Now lets check whether a subsequent commit() does anything $userPersister->reset(); // Test $this->_unitOfWork->commit(); - + // Check. $this->assertEquals(1, count($userPersister->getInserts())); $this->assertEquals(0, count($userPersister->getUpdates())); $this->assertEquals(0, count($userPersister->getDeletes())); - + // should have an id $this->assertTrue(is_numeric($user->id)); } @@ -112,7 +112,7 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase $avatar = new ForumAvatar(); $user->avatar = $avatar; $this->_unitOfWork->persist($user); // save cascaded to avatar - + $this->_unitOfWork->commit(); $this->assertTrue(is_numeric($user->id)); @@ -137,7 +137,7 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase $entity = new NotifyChangedEntity; $entity->setData('thedata'); $this->_unitOfWork->persist($entity); - + $this->_unitOfWork->commit(); $this->assertEquals(1, count($persister->getInserts())); $persister->reset(); @@ -161,7 +161,7 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase $persister->reset(); $itemPersister->reset(); - + $entity->getItems()->removeElement($item); $item->setOwner(null); $this->assertTrue($entity->getItems()->isDirty()); diff --git a/tests/Doctrine/Tests/OrmFunctionalTestCase.php b/tests/Doctrine/Tests/OrmFunctionalTestCase.php index e0b9d7bee..ba54da95c 100644 --- a/tests/Doctrine/Tests/OrmFunctionalTestCase.php +++ b/tests/Doctrine/Tests/OrmFunctionalTestCase.php @@ -16,7 +16,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase /* Shared connection when a TestCase is run alone (outside of it's functional suite) */ protected static $_sharedConn; - + /** * @var \Doctrine\ORM\EntityManager */ @@ -123,7 +123,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase { $this->_usedModelSets[$setName] = true; } - + /** * Sweeps the database tables and clears the EntityManager. */ @@ -241,10 +241,10 @@ abstract class OrmFunctionalTestCase extends OrmTestCase protected function setUp() { $forceCreateTables = false; - + if ( ! isset(static::$_sharedConn)) { static::$_sharedConn = TestUtil::getConnection(); - + if (static::$_sharedConn->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) { $forceCreateTables = true; } @@ -257,24 +257,24 @@ abstract class OrmFunctionalTestCase extends OrmTestCase static::$_sharedConn->executeQuery('SELECT 1 /*' . get_class($this) . '*/ FROM dual'); } } - + if ( ! $this->_em) { $this->_em = $this->_getEntityManager(); $this->_schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->_em); } $classes = array(); - + foreach ($this->_usedModelSets as $setName => $bool) { if ( ! isset(static::$_tablesCreated[$setName])/* || $forceCreateTables*/) { foreach (static::$_modelSets[$setName] as $className) { $classes[] = $this->_em->getClassMetadata($className); } - + static::$_tablesCreated[$setName] = true; } } - + if ($classes) { $this->_schemaTool->createSchema($classes); } @@ -303,7 +303,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase $this->_sqlLoggerStack = new \Doctrine\DBAL\Logging\DebugStack(); $this->_sqlLoggerStack->enabled = false; - + //FIXME: two different configs! $conn and the created entity manager have // different configs. $config = new \Doctrine\ORM\Configuration(); @@ -313,7 +313,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase $config->setProxyNamespace('Doctrine\Tests\Proxies'); $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver()); - + $conn = static::$_sharedConn; $conn->getConfiguration()->setSQLLogger($this->_sqlLoggerStack); @@ -324,7 +324,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase $evm->removeEventListener(array($event), $listener); } } - + if (isset($GLOBALS['db_event_subscribers'])) { foreach (explode(",", $GLOBALS['db_event_subscribers']) AS $subscriberClass) { $subscriberInstance = new $subscriberClass(); @@ -335,7 +335,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase if (isset($GLOBALS['debug_uow_listener'])) { $evm->addEventListener(array('onFlush'), new \Doctrine\ORM\Tools\DebugUnitOfWorkListener()); } - + return \Doctrine\ORM\EntityManager::create($conn, $config); } @@ -352,7 +352,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase $params = array_map(function($p) { if (is_object($p)) return get_class($p); else return "'".$p."'"; }, $query['params'] ?: array()); $queries .= ($i+1).". SQL: '".$query['sql']."' Params: ".implode(", ", $params).PHP_EOL; } - + $trace = $e->getTrace(); $traceMsg = ""; foreach($trace AS $part) { @@ -375,7 +375,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase /** * Using the SQL Logger Stack this method retrieves the current query count executed in this test. - * + * * @return int */ protected function getCurrentQueryCount() diff --git a/tests/Doctrine/Tests/OrmTestCase.php b/tests/Doctrine/Tests/OrmTestCase.php index 2a7b37dc9..23099ac77 100644 --- a/tests/Doctrine/Tests/OrmTestCase.php +++ b/tests/Doctrine/Tests/OrmTestCase.php @@ -11,7 +11,7 @@ abstract class OrmTestCase extends DoctrineTestCase { /** The metadata cache that is shared between all ORM tests (except functional tests). */ private static $_metadataCacheImpl = null; - + /** The query cache that is shared between all ORM tests (except functional tests). */ private static $_queryCacheImpl = null; @@ -56,10 +56,10 @@ abstract class OrmTestCase extends DoctrineTestCase __DIR__ . "/../../../lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php"); return new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, (array)$paths); } - + /** * Creates an EntityManager for testing purposes. - * + * * NOTE: The created EntityManager will have its dependant DBAL parts completely * mocked out using a DriverMock, ConnectionMock, etc. These mocks can then * be configured in the tests to simulate the DBAL behavior that is desired @@ -69,18 +69,18 @@ abstract class OrmTestCase extends DoctrineTestCase */ protected function _getTestEntityManager($conn = null, $conf = null, $eventManager = null, $withSharedMetadata = true) { - $metadataCache = $withSharedMetadata - ? self::getSharedMetadataCacheImpl() + $metadataCache = $withSharedMetadata + ? self::getSharedMetadataCacheImpl() : new \Doctrine\Common\Cache\ArrayCache; - + $config = new \Doctrine\ORM\Configuration(); - + $config->setMetadataCacheImpl($metadataCache); $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver()); $config->setQueryCacheImpl(self::getSharedQueryCacheImpl()); $config->setProxyDir(__DIR__ . '/Proxies'); $config->setProxyNamespace('Doctrine\Tests\Proxies'); - + if ($conn === null) { $conn = array( 'driverClass' => 'Doctrine\Tests\Mocks\DriverMock', @@ -89,11 +89,11 @@ abstract class OrmTestCase extends DoctrineTestCase 'password' => 'wayne' ); } - + if (is_array($conn)) { $conn = \Doctrine\DBAL\DriverManager::getConnection($conn, $config, $eventManager); } - + return \Doctrine\Tests\Mocks\EntityManagerMock::create($conn, $config, $eventManager); } @@ -102,16 +102,16 @@ abstract class OrmTestCase extends DoctrineTestCase if (self::$_metadataCacheImpl === null) { self::$_metadataCacheImpl = new \Doctrine\Common\Cache\ArrayCache; } - + return self::$_metadataCacheImpl; } - + private static function getSharedQueryCacheImpl() { if (self::$_queryCacheImpl === null) { self::$_queryCacheImpl = new \Doctrine\Common\Cache\ArrayCache; } - + return self::$_queryCacheImpl; } } diff --git a/tests/NativePhpunitTask.php b/tests/NativePhpunitTask.php index 1ef582dfe..8a3b190c7 100644 --- a/tests/NativePhpunitTask.php +++ b/tests/NativePhpunitTask.php @@ -244,6 +244,6 @@ class NativePhpunitPrinter extends PHPUnit_Util_Printer implements PHPUnit_Frame */ public function endTest(PHPUnit_Framework_Test $test, $time) { - + } } \ No newline at end of file