@@ -225,6 +225,9 @@ discard block |
||
| 225 | 225 | self::assertEquals([], $metadata); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | + /** |
|
| 229 | + * @param \PHPUnit_Framework_MockObject_MockObject $conn |
|
| 230 | + */ |
|
| 228 | 231 | protected function createEntityManager($metadataDriver, $conn = null) |
| 229 | 232 | { |
| 230 | 233 | $driverMock = new DriverMock(); |
@@ -257,7 +260,6 @@ discard block |
||
| 257 | 260 | } |
| 258 | 261 | |
| 259 | 262 | /** |
| 260 | - * @param string $class |
|
| 261 | 263 | * @return ClassMetadata |
| 262 | 264 | */ |
| 263 | 265 | protected function createValidClassMetadata() |
@@ -498,6 +500,10 @@ discard block |
||
| 498 | 500 | return $this->mockMetadata[$className]; |
| 499 | 501 | } |
| 500 | 502 | |
| 503 | + /** |
|
| 504 | + * @param string $className |
|
| 505 | + * @param ClassMetadata $metadata |
|
| 506 | + */ |
|
| 501 | 507 | public function setMetadataForClass($className, $metadata) |
| 502 | 508 | { |
| 503 | 509 | $this->mockMetadata[$className] = $metadata; |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | $cmf = new ClassMetadataFactory(); |
| 130 | 130 | $driver = $this->createMock(MappingDriver::class); |
| 131 | 131 | $driver->expects($this->at(0)) |
| 132 | - ->method('isTransient') |
|
| 133 | - ->with($this->equalTo(CmsUser::class)) |
|
| 134 | - ->will($this->returnValue(true)); |
|
| 132 | + ->method('isTransient') |
|
| 133 | + ->with($this->equalTo(CmsUser::class)) |
|
| 134 | + ->will($this->returnValue(true)); |
|
| 135 | 135 | $driver->expects($this->at(1)) |
| 136 | - ->method('isTransient') |
|
| 137 | - ->with($this->equalTo(CmsArticle::class)) |
|
| 138 | - ->will($this->returnValue(false)); |
|
| 136 | + ->method('isTransient') |
|
| 137 | + ->with($this->equalTo(CmsArticle::class)) |
|
| 138 | + ->will($this->returnValue(false)); |
|
| 139 | 139 | |
| 140 | 140 | $em = $this->createEntityManager($driver); |
| 141 | 141 | |
@@ -151,13 +151,13 @@ discard block |
||
| 151 | 151 | $cmf = new ClassMetadataFactory(); |
| 152 | 152 | $driver = $this->createMock(MappingDriver::class); |
| 153 | 153 | $driver->expects($this->at(0)) |
| 154 | - ->method('isTransient') |
|
| 155 | - ->with($this->equalTo(CmsUser::class)) |
|
| 156 | - ->will($this->returnValue(true)); |
|
| 154 | + ->method('isTransient') |
|
| 155 | + ->with($this->equalTo(CmsUser::class)) |
|
| 156 | + ->will($this->returnValue(true)); |
|
| 157 | 157 | $driver->expects($this->at(1)) |
| 158 | - ->method('isTransient') |
|
| 159 | - ->with($this->equalTo(CmsArticle::class)) |
|
| 160 | - ->will($this->returnValue(false)); |
|
| 158 | + ->method('isTransient') |
|
| 159 | + ->with($this->equalTo(CmsArticle::class)) |
|
| 160 | + ->will($this->returnValue(false)); |
|
| 161 | 161 | |
| 162 | 162 | $em = $this->createEntityManager($driver); |
| 163 | 163 | $em->getConfiguration()->addEntityNamespace('CMS', 'Doctrine\Tests\Models\CMS'); |
@@ -316,8 +316,8 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | /** |
| 319 | - * @group DDC-1845 |
|
| 320 | - */ |
|
| 319 | + * @group DDC-1845 |
|
| 320 | + */ |
|
| 321 | 321 | public function testQuoteMetadata() |
| 322 | 322 | { |
| 323 | 323 | $cmf = new ClassMetadataFactory(); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Doctrine\Tests\ORM\Mapping; |
| 6 | 6 | |
@@ -106,15 +106,15 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | require_once __DIR__."/../../Models/Global/GlobalNamespaceModel.php"; |
| 108 | 108 | |
| 109 | - $metadataDriver = $this->createAnnotationDriver([__DIR__ . '/../../Models/Global/']); |
|
| 109 | + $metadataDriver = $this->createAnnotationDriver([__DIR__.'/../../Models/Global/']); |
|
| 110 | 110 | |
| 111 | 111 | $entityManager = $this->createEntityManager($metadataDriver); |
| 112 | 112 | |
| 113 | 113 | $mf = $entityManager->getMetadataFactory(); |
| 114 | 114 | $m1 = $mf->getMetadataFor(DoctrineGlobal_Article::class); |
| 115 | 115 | $h1 = $mf->hasMetadataFor(DoctrineGlobal_Article::class); |
| 116 | - $h2 = $mf->hasMetadataFor('\\' . DoctrineGlobal_Article::class); |
|
| 117 | - $m2 = $mf->getMetadataFor('\\' . DoctrineGlobal_Article::class); |
|
| 116 | + $h2 = $mf->hasMetadataFor('\\'.DoctrineGlobal_Article::class); |
|
| 117 | + $m2 = $mf->getMetadataFor('\\'.DoctrineGlobal_Article::class); |
|
| 118 | 118 | |
| 119 | 119 | self::assertNotSame($m1, $m2); |
| 120 | 120 | self::assertFalse($h2); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | public function testAddDefaultDiscriminatorMap() |
| 170 | 170 | { |
| 171 | 171 | $cmf = new ClassMetadataFactory(); |
| 172 | - $driver = $this->createAnnotationDriver([__DIR__ . '/../../Models/JoinedInheritanceType/']); |
|
| 172 | + $driver = $this->createAnnotationDriver([__DIR__.'/../../Models/JoinedInheritanceType/']); |
|
| 173 | 173 | $em = $this->createEntityManager($driver); |
| 174 | 174 | $cmf->setEntityManager($em); |
| 175 | 175 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | { |
| 210 | 210 | // DDC-3551 |
| 211 | 211 | $conn = $this->createMock(Connection::class); |
| 212 | - $mockDriver = new MetadataDriverMock(); |
|
| 212 | + $mockDriver = new MetadataDriverMock(); |
|
| 213 | 213 | $em = $this->createEntityManager($mockDriver, $conn); |
| 214 | 214 | |
| 215 | 215 | $conn->expects($this->any()) |
@@ -230,12 +230,12 @@ discard block |
||
| 230 | 230 | $driverMock = new DriverMock(); |
| 231 | 231 | $config = new Configuration(); |
| 232 | 232 | |
| 233 | - $config->setProxyDir(__DIR__ . '/../../Proxies'); |
|
| 233 | + $config->setProxyDir(__DIR__.'/../../Proxies'); |
|
| 234 | 234 | $config->setProxyNamespace('Doctrine\Tests\Proxies'); |
| 235 | 235 | |
| 236 | 236 | $eventManager = new EventManager(); |
| 237 | 237 | |
| 238 | - if (!$conn) { |
|
| 238 | + if ( ! $conn) { |
|
| 239 | 239 | $conn = new ConnectionMock([], $driverMock, $config, $eventManager); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | public function testQuoteMetadata() |
| 322 | 322 | { |
| 323 | 323 | $cmf = new ClassMetadataFactory(); |
| 324 | - $driver = $this->createAnnotationDriver([__DIR__ . '/../../Models/Quote/']); |
|
| 324 | + $driver = $this->createAnnotationDriver([__DIR__.'/../../Models/Quote/']); |
|
| 325 | 325 | $em = $this->createEntityManager($driver); |
| 326 | 326 | $cmf->setEntityManager($em); |
| 327 | 327 | |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | $listener |
| 411 | 411 | ->expects($this->any()) |
| 412 | 412 | ->method('onClassMetadataNotFound') |
| 413 | - ->will($this->returnCallback(function (OnClassMetadataNotFoundEventArgs $args) use ($metadata, $em, $test) { |
|
| 413 | + ->will($this->returnCallback(function(OnClassMetadataNotFoundEventArgs $args) use ($metadata, $em, $test) { |
|
| 414 | 414 | $test->assertNull($args->getFoundMetadata()); |
| 415 | 415 | $test->assertSame('Foo', $args->getClassName()); |
| 416 | 416 | $test->assertSame($em, $args->getObjectManager()); |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | public function testInheritsIdGeneratorMappingFromEmbeddable() |
| 473 | 473 | { |
| 474 | 474 | $cmf = new ClassMetadataFactory(); |
| 475 | - $driver = $this->createAnnotationDriver([__DIR__ . '/../../Models/DDC4006/']); |
|
| 475 | + $driver = $this->createAnnotationDriver([__DIR__.'/../../Models/DDC4006/']); |
|
| 476 | 476 | $em = $this->createEntityManager($driver); |
| 477 | 477 | $cmf->setEntityManager($em); |
| 478 | 478 | |
@@ -127,6 +127,9 @@ discard block |
||
| 127 | 127 | self::assertEquals(503, $this->countQuery($em)); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | + /** |
|
| 131 | + * @param string $label |
|
| 132 | + */ |
|
| 130 | 133 | private function queryEntity(EntityManagerInterface $em, $label) |
| 131 | 134 | { |
| 132 | 135 | $times = 100; |
@@ -158,6 +161,9 @@ discard block |
||
| 158 | 161 | printf("\n%s\n", str_repeat('-', 50)); |
| 159 | 162 | } |
| 160 | 163 | |
| 164 | + /** |
|
| 165 | + * @param string $label |
|
| 166 | + */ |
|
| 161 | 167 | public function findEntityOneToMany(EntityManagerInterface $em, $label) |
| 162 | 168 | { |
| 163 | 169 | $times = 50; |
@@ -217,6 +223,9 @@ discard block |
||
| 217 | 223 | printf("\n%s\n", str_repeat('-', 50)); |
| 218 | 224 | } |
| 219 | 225 | |
| 226 | + /** |
|
| 227 | + * @param string $label |
|
| 228 | + */ |
|
| 220 | 229 | private function findEntity(EntityManagerInterface $em, $label) |
| 221 | 230 | { |
| 222 | 231 | $times = 10; |
@@ -252,6 +261,9 @@ discard block |
||
| 252 | 261 | printf("\n%s\n", str_repeat('-', 50)); |
| 253 | 262 | } |
| 254 | 263 | |
| 264 | + /** |
|
| 265 | + * @param string $label |
|
| 266 | + */ |
|
| 255 | 267 | private function findAllEntity(EntityManagerInterface $em, $label) |
| 256 | 268 | { |
| 257 | 269 | $times = 100; |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Doctrine\Tests\ORM\Performance; |
| 6 | 6 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $size = 500; |
| 134 | 134 | $startPersist = microtime(true); |
| 135 | 135 | |
| 136 | - echo PHP_EOL . $label; |
|
| 136 | + echo PHP_EOL.$label; |
|
| 137 | 137 | |
| 138 | 138 | for ($i = 0; $i < $size; $i++) { |
| 139 | 139 | $em->persist(new Country("Country $i")); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $startPersist = microtime(true); |
| 168 | 168 | $country = new Country("Country"); |
| 169 | 169 | |
| 170 | - echo PHP_EOL . $label; |
|
| 170 | + echo PHP_EOL.$label; |
|
| 171 | 171 | |
| 172 | 172 | $em->persist($country); |
| 173 | 173 | $em->flush(); |
@@ -197,9 +197,9 @@ discard block |
||
| 197 | 197 | $em->flush(); |
| 198 | 198 | $em->clear(); |
| 199 | 199 | |
| 200 | - printf("\n[%s] persist %s states and %s cities", number_format( microtime(true) - $startPersist, 6), count($states), count($cities)); |
|
| 200 | + printf("\n[%s] persist %s states and %s cities", number_format(microtime(true) - $startPersist, 6), count($states), count($cities)); |
|
| 201 | 201 | |
| 202 | - $startFind = microtime(true); |
|
| 202 | + $startFind = microtime(true); |
|
| 203 | 203 | |
| 204 | 204 | for ($i = 0; $i < $times; $i++) { |
| 205 | 205 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $countries = []; |
| 225 | 225 | $startPersist = microtime(true); |
| 226 | 226 | |
| 227 | - echo PHP_EOL . $label; |
|
| 227 | + echo PHP_EOL.$label; |
|
| 228 | 228 | |
| 229 | 229 | for ($i = 0; $i < $size; $i++) { |
| 230 | 230 | $country = new Country("Country $i"); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | printf("\n[%s] persist %s countries", number_format(microtime(true) - $startPersist, 6), $size); |
| 241 | 241 | |
| 242 | - $startFind = microtime(true); |
|
| 242 | + $startFind = microtime(true); |
|
| 243 | 243 | |
| 244 | 244 | for ($i = 0; $i <= $times; $i++) { |
| 245 | 245 | foreach ($countries as $country) { |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | $startPersist = microtime(true); |
| 260 | 260 | $rep = $em->getRepository(Country::class); |
| 261 | 261 | |
| 262 | - echo PHP_EOL . $label; |
|
| 262 | + echo PHP_EOL.$label; |
|
| 263 | 263 | |
| 264 | 264 | for ($i = 0; $i < $size; $i++) { |
| 265 | 265 | $em->persist(new Country("Country $i")); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | printf("\n[%s] persist %s countries", number_format(microtime(true) - $startPersist, 6), $size); |
| 272 | 272 | |
| 273 | - $startFind = microtime(true); |
|
| 273 | + $startFind = microtime(true); |
|
| 274 | 274 | |
| 275 | 275 | for ($i = 0; $i <= $times; $i++) { |
| 276 | 276 | $list = $rep->findAll(); |
@@ -10,7 +10,6 @@ |
||
| 10 | 10 | use Doctrine\ORM\Mapping\OneToOneAssociationMetadata; |
| 11 | 11 | use Doctrine\ORM\Persisters\Entity\BasicEntityPersister; |
| 12 | 12 | use Doctrine\Tests\Models\CustomType\CustomTypeChild; |
| 13 | -use Doctrine\Tests\Models\CustomType\CustomTypeFriend; |
|
| 14 | 13 | use Doctrine\Tests\Models\CustomType\CustomTypeParent; |
| 15 | 14 | use Doctrine\Tests\Models\Generic\NonAlphaColumnsEntity; |
| 16 | 15 | use Doctrine\Tests\OrmTestCase; |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Doctrine\Tests\ORM\Persisters; |
| 6 | 6 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $method = new \ReflectionMethod($this->persister, 'getSelectConditionSQL'); |
| 94 | 94 | $method->setAccessible(true); |
| 95 | 95 | |
| 96 | - $sql = $method->invoke($this->persister, ['customInteger' => 1, 'child' => 1]); |
|
| 96 | + $sql = $method->invoke($this->persister, ['customInteger' => 1, 'child' => 1]); |
|
| 97 | 97 | |
| 98 | 98 | self::assertEquals('t0."customInteger" = ABS(?) AND t0."child_id" = ?', $sql); |
| 99 | 99 | } |
@@ -25,6 +25,10 @@ |
||
| 25 | 25 | $this->em = $this->getTestEntityManager(); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | + /** |
|
| 29 | + * @param string $dqlToBeTested |
|
| 30 | + * @param string $sqlToBeConfirmed |
|
| 31 | + */ |
|
| 28 | 32 | public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed) |
| 29 | 33 | { |
| 30 | 34 | try { |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | try { |
| 31 | 31 | $query = $this->em->createQuery($dqlToBeTested); |
| 32 | 32 | $query->setHint(Query::HINT_CUSTOM_TREE_WALKERS, [CustomTreeWalkerJoin::class]) |
| 33 | - ->useQueryCache(false); |
|
| 33 | + ->useQueryCache(false); |
|
| 34 | 34 | |
| 35 | 35 | $sqlGenerated = $query->getSql(); |
| 36 | 36 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Doctrine\Tests\ORM\Query; |
| 6 | 6 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $query->free(); |
| 38 | 38 | } catch (\Exception $e) { |
| 39 | - $this->fail($e->getMessage() . ' at "' . $e->getFile() . '" on line ' . $e->getLine()); |
|
| 39 | + $this->fail($e->getMessage().' at "'.$e->getFile().'" on line '.$e->getLine()); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | self::assertEquals($sqlToBeConfirmed, $sqlGenerated); |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | $rangeVariableDecl = $identificationVariableDecl->rangeVariableDeclaration; |
| 80 | 80 | $joinAssocPathExpression = new Query\AST\JoinAssociationPathExpression($rangeVariableDecl->aliasIdentificationVariable, 'address'); |
| 81 | - $joinAssocDeclaration = new Query\AST\JoinAssociationDeclaration($joinAssocPathExpression, $rangeVariableDecl->aliasIdentificationVariable . 'a', null); |
|
| 81 | + $joinAssocDeclaration = new Query\AST\JoinAssociationDeclaration($joinAssocPathExpression, $rangeVariableDecl->aliasIdentificationVariable.'a', null); |
|
| 82 | 82 | $join = new Query\AST\Join(Query\AST\Join::JOIN_TYPE_LEFT, $joinAssocDeclaration); |
| 83 | - $selectExpression = new Query\AST\SelectExpression($rangeVariableDecl->aliasIdentificationVariable . 'a', null, false); |
|
| 83 | + $selectExpression = new Query\AST\SelectExpression($rangeVariableDecl->aliasIdentificationVariable.'a', null, false); |
|
| 84 | 84 | |
| 85 | 85 | $identificationVariableDecl->joins[] = $join; |
| 86 | 86 | $selectStatement->selectClause->selectExpressions[] = $selectExpression; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $userMetadata = $entityManager->getClassMetadata(CmsUser::class); |
| 90 | 90 | $addressMetadata = $entityManager->getClassMetadata(CmsAddress::class); |
| 91 | 91 | |
| 92 | - $this->setQueryComponent($rangeVariableDecl->aliasIdentificationVariable . 'a', |
|
| 92 | + $this->setQueryComponent($rangeVariableDecl->aliasIdentificationVariable.'a', |
|
| 93 | 93 | [ |
| 94 | 94 | 'metadata' => $addressMetadata, |
| 95 | 95 | 'parent' => $rangeVariableDecl->aliasIdentificationVariable, |
@@ -27,6 +27,10 @@ |
||
| 27 | 27 | $this->em = $this->getTestEntityManager(); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | + /** |
|
| 31 | + * @param string $dqlToBeTested |
|
| 32 | + * @param string $sqlToBeConfirmed |
|
| 33 | + */ |
|
| 30 | 34 | public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed) |
| 31 | 35 | { |
| 32 | 36 | try { |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Doctrine\Tests\ORM\Query; |
| 6 | 6 | use Doctrine\Tests\OrmTestCase; |
@@ -30,6 +30,10 @@ |
||
| 30 | 30 | $this->em = $this->getTestEntityManager(); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | + /** |
|
| 34 | + * @param string $dqlToBeTested |
|
| 35 | + * @param string $sqlToBeConfirmed |
|
| 36 | + */ |
|
| 33 | 37 | public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed) |
| 34 | 38 | { |
| 35 | 39 | try { |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Doctrine\Tests\ORM\Query; |
| 6 | 6 | |
@@ -37,6 +37,9 @@ |
||
| 37 | 37 | $this->em = $this->getTestEntityManager(); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | + /** |
|
| 41 | + * @param string $expectedDql |
|
| 42 | + */ |
|
| 40 | 43 | protected function assertValidQueryBuilder(QueryBuilder $qb, $expectedDql) |
| 41 | 44 | { |
| 42 | 45 | $dql = $qb->getDQL(); |
@@ -274,12 +274,12 @@ discard block |
||
| 274 | 274 | { |
| 275 | 275 | $qb = $this->em->createQueryBuilder(); |
| 276 | 276 | $qb->select('u') |
| 277 | - ->from(CmsUser::class, 'u') |
|
| 278 | - ->where('u.id = :uid') |
|
| 279 | - ->orWhere('u.id = :uid2') |
|
| 280 | - ->andWhere('u.id = :uid3') |
|
| 281 | - ->orWhere('u.name = :name1', 'u.name = :name2') |
|
| 282 | - ->andWhere('u.name <> :noname'); |
|
| 277 | + ->from(CmsUser::class, 'u') |
|
| 278 | + ->where('u.id = :uid') |
|
| 279 | + ->orWhere('u.id = :uid2') |
|
| 280 | + ->andWhere('u.id = :uid3') |
|
| 281 | + ->orWhere('u.name = :name1', 'u.name = :name2') |
|
| 282 | + ->andWhere('u.name <> :noname'); |
|
| 283 | 283 | |
| 284 | 284 | self::assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE (((u.id = :uid OR u.id = :uid2) AND u.id = :uid3) OR u.name = :name1 OR u.name = :name2) AND u.name <> :noname'); |
| 285 | 285 | } |
@@ -288,9 +288,9 @@ discard block |
||
| 288 | 288 | { |
| 289 | 289 | $qb = $this->em->createQueryBuilder(); |
| 290 | 290 | $qb->select('u') |
| 291 | - ->from(CmsUser::class, 'u') |
|
| 292 | - ->where('u.id = :uid') |
|
| 293 | - ->andWhere($qb->expr()->in('u.id', [1, 2, 3])); |
|
| 291 | + ->from(CmsUser::class, 'u') |
|
| 292 | + ->where('u.id = :uid') |
|
| 293 | + ->andWhere($qb->expr()->in('u.id', [1, 2, 3])); |
|
| 294 | 294 | |
| 295 | 295 | self::assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid AND u.id IN(1, 2, 3)'); |
| 296 | 296 | } |
@@ -299,9 +299,9 @@ discard block |
||
| 299 | 299 | { |
| 300 | 300 | $qb = $this->em->createQueryBuilder(); |
| 301 | 301 | $qb->select('u') |
| 302 | - ->from(CmsUser::class, 'u') |
|
| 303 | - ->where('u.id = :uid') |
|
| 304 | - ->orWhere($qb->expr()->in('u.id', [1, 2, 3])); |
|
| 302 | + ->from(CmsUser::class, 'u') |
|
| 303 | + ->where('u.id = :uid') |
|
| 304 | + ->orWhere($qb->expr()->in('u.id', [1, 2, 3])); |
|
| 305 | 305 | |
| 306 | 306 | self::assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid OR u.id IN(1, 2, 3)'); |
| 307 | 307 | } |
@@ -310,9 +310,9 @@ discard block |
||
| 310 | 310 | { |
| 311 | 311 | $qb = $this->em->createQueryBuilder(); |
| 312 | 312 | $qb->select('u') |
| 313 | - ->from(CmsUser::class, 'u') |
|
| 314 | - ->where('u.id = :uid') |
|
| 315 | - ->andWhere($qb->expr()->notIn('u.id', [1, 2, 3])); |
|
| 313 | + ->from(CmsUser::class, 'u') |
|
| 314 | + ->where('u.id = :uid') |
|
| 315 | + ->andWhere($qb->expr()->notIn('u.id', [1, 2, 3])); |
|
| 316 | 316 | |
| 317 | 317 | self::assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid AND u.id NOT IN(1, 2, 3)'); |
| 318 | 318 | } |
@@ -321,9 +321,9 @@ discard block |
||
| 321 | 321 | { |
| 322 | 322 | $qb = $this->em->createQueryBuilder(); |
| 323 | 323 | $qb->select('u') |
| 324 | - ->from(CmsUser::class, 'u') |
|
| 325 | - ->where('u.id = :uid') |
|
| 326 | - ->orWhere($qb->expr()->notIn('u.id', [1, 2, 3])); |
|
| 324 | + ->from(CmsUser::class, 'u') |
|
| 325 | + ->where('u.id = :uid') |
|
| 326 | + ->orWhere($qb->expr()->notIn('u.id', [1, 2, 3])); |
|
| 327 | 327 | |
| 328 | 328 | self::assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid OR u.id NOT IN(1, 2, 3)'); |
| 329 | 329 | } |
@@ -619,8 +619,8 @@ discard block |
||
| 619 | 619 | { |
| 620 | 620 | $qb = $this->em->createQueryBuilder(); |
| 621 | 621 | $qb->select('u') |
| 622 | - ->from(CmsUser::class, 'u') |
|
| 623 | - ->where($qb->expr()->orX('u.username = :username', 'u.username = :username2')); |
|
| 622 | + ->from(CmsUser::class, 'u') |
|
| 623 | + ->where($qb->expr()->orX('u.username = :username', 'u.username = :username2')); |
|
| 624 | 624 | |
| 625 | 625 | $parameters = new ArrayCollection(); |
| 626 | 626 | $parameters->add(new Parameter('username', 'jwage')); |
@@ -636,8 +636,8 @@ discard block |
||
| 636 | 636 | { |
| 637 | 637 | $qb = $this->em->createQueryBuilder(); |
| 638 | 638 | $qb->select('u') |
| 639 | - ->from(CmsUser::class, 'u') |
|
| 640 | - ->where('u.id = :id'); |
|
| 639 | + ->from(CmsUser::class, 'u') |
|
| 640 | + ->where('u.id = :id'); |
|
| 641 | 641 | |
| 642 | 642 | $parameters = new ArrayCollection(); |
| 643 | 643 | $parameters->add(new Parameter('id', 1)); |
@@ -686,8 +686,8 @@ discard block |
||
| 686 | 686 | { |
| 687 | 687 | $qb = $this->em->createQueryBuilder(); |
| 688 | 688 | $qb->select('u') |
| 689 | - ->from(CmsUser::class, 'u') |
|
| 690 | - ->orWhere('u.id = :uid', $qb->expr()->eq('u.id', ':uid2')); |
|
| 689 | + ->from(CmsUser::class, 'u') |
|
| 690 | + ->orWhere('u.id = :uid', $qb->expr()->eq('u.id', ':uid2')); |
|
| 691 | 691 | |
| 692 | 692 | self::assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid OR u.id = :uid2'); |
| 693 | 693 | } |
@@ -700,8 +700,8 @@ discard block |
||
| 700 | 700 | $orExpr->add($qb->expr()->in('u.id', [1])); |
| 701 | 701 | |
| 702 | 702 | $qb->select('u') |
| 703 | - ->from(CmsUser::class, 'u') |
|
| 704 | - ->where($orExpr); |
|
| 703 | + ->from(CmsUser::class, 'u') |
|
| 704 | + ->where($orExpr); |
|
| 705 | 705 | |
| 706 | 706 | self::assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid3 OR u.id IN(1)'); |
| 707 | 707 | } |
@@ -710,8 +710,8 @@ discard block |
||
| 710 | 710 | { |
| 711 | 711 | $qb = $this->em->createQueryBuilder(); |
| 712 | 712 | $qb->select('u') |
| 713 | - ->from(CmsUser::class, 'u') |
|
| 714 | - ->where($qb->expr()->in('u.name', ['one', 'two', 'three'])); |
|
| 713 | + ->from(CmsUser::class, 'u') |
|
| 714 | + ->where($qb->expr()->in('u.name', ['one', 'two', 'three'])); |
|
| 715 | 715 | |
| 716 | 716 | self::assertValidQueryBuilder($qb, "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name IN('one', 'two', 'three')"); |
| 717 | 717 | |
@@ -725,8 +725,8 @@ discard block |
||
| 725 | 725 | $qb = $this->em->createQueryBuilder(); |
| 726 | 726 | $expr = $this->em->getExpressionBuilder(); |
| 727 | 727 | $qb->select('u') |
| 728 | - ->from(CmsUser::class, 'u') |
|
| 729 | - ->where($expr->in('u.name', [$expr->literal('one'), $expr->literal('two'), $expr->literal('three')])); |
|
| 728 | + ->from(CmsUser::class, 'u') |
|
| 729 | + ->where($expr->in('u.name', [$expr->literal('one'), $expr->literal('two'), $expr->literal('three')])); |
|
| 730 | 730 | |
| 731 | 731 | self::assertValidQueryBuilder($qb, "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name IN('one', 'two', 'three')"); |
| 732 | 732 | |
@@ -744,8 +744,8 @@ discard block |
||
| 744 | 744 | |
| 745 | 745 | $qb = $this->em->createQueryBuilder(); |
| 746 | 746 | $qb->select('u') |
| 747 | - ->from(CmsUser::class, 'u') |
|
| 748 | - ->where($orExpr); |
|
| 747 | + ->from(CmsUser::class, 'u') |
|
| 748 | + ->where($orExpr); |
|
| 749 | 749 | |
| 750 | 750 | self::assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid3 OR NOT(u.id IN(1))'); |
| 751 | 751 | } |
@@ -756,8 +756,8 @@ discard block |
||
| 756 | 756 | $expr = $this->em->getExpressionBuilder(); |
| 757 | 757 | |
| 758 | 758 | $qb->select('u') |
| 759 | - ->from(CmsUser::class, 'u') |
|
| 760 | - ->where($expr->gt('u.id', $expr->all('select a.id from Doctrine\Tests\Models\CMS\CmsArticle a'))); |
|
| 759 | + ->from(CmsUser::class, 'u') |
|
| 760 | + ->where($expr->gt('u.id', $expr->all('select a.id from Doctrine\Tests\Models\CMS\CmsArticle a'))); |
|
| 761 | 761 | |
| 762 | 762 | self::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)'); |
| 763 | 763 | |
@@ -1123,9 +1123,9 @@ discard block |
||
| 1123 | 1123 | public function testRebuildsFromParts() |
| 1124 | 1124 | { |
| 1125 | 1125 | $qb = $this->em->createQueryBuilder() |
| 1126 | - ->select('u') |
|
| 1127 | - ->from(CmsUser::class, 'u') |
|
| 1128 | - ->join('u.article', 'a'); |
|
| 1126 | + ->select('u') |
|
| 1127 | + ->from(CmsUser::class, 'u') |
|
| 1128 | + ->join('u.article', 'a'); |
|
| 1129 | 1129 | |
| 1130 | 1130 | $dqlParts = $qb->getDQLParts(); |
| 1131 | 1131 | $dql = $qb->getDQL(); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Doctrine\Tests\ORM; |
| 6 | 6 | |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | $qb = $this->em->createQueryBuilder(); |
| 550 | 550 | $qb->select('u') |
| 551 | 551 | ->from(CmsUser::class, 'u') |
| 552 | - ->join('u.article','a'); |
|
| 552 | + ->join('u.article', 'a'); |
|
| 553 | 553 | |
| 554 | 554 | $criteria = new Criteria(); |
| 555 | 555 | $criteria->orderBy(['a.field' => Criteria::DESC]); |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | ->from(CmsUser::class, 'u') |
| 827 | 827 | ->where('u.username = ?1')->orderBy('u.username'); |
| 828 | 828 | |
| 829 | - self::assertEquals('u.username = ?1', (string)$qb->getDQLPart('where')); |
|
| 829 | + self::assertEquals('u.username = ?1', (string) $qb->getDQLPart('where')); |
|
| 830 | 830 | self::assertEquals(1, count($qb->getDQLPart('orderBy'))); |
| 831 | 831 | |
| 832 | 832 | $qb->resetDQLPart('where')->resetDQLPart('orderBy'); |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | { |
| 891 | 891 | $qb = $this->em->createQueryBuilder(); |
| 892 | 892 | $qb->select('alias1')->from(CmsUser::class, 'alias1'); |
| 893 | - $qb->join('alias1.articles','alias2'); |
|
| 893 | + $qb->join('alias1.articles', 'alias2'); |
|
| 894 | 894 | |
| 895 | 895 | $criteria = new Criteria(); |
| 896 | 896 | $criteria->where($criteria->expr()->eq('field', 'value1')); |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | { |
| 911 | 911 | $qb = $this->em->createQueryBuilder(); |
| 912 | 912 | $qb->select('alias1')->from(CmsUser::class, 'alias1'); |
| 913 | - $qb->join('alias1.articles','alias2'); |
|
| 913 | + $qb->join('alias1.articles', 'alias2'); |
|
| 914 | 914 | |
| 915 | 915 | $criteria = new Criteria(); |
| 916 | 916 | $criteria->where($criteria->expr()->eq('alias1.field', 'value1')); |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | { |
| 931 | 931 | $qb = $this->em->createQueryBuilder(); |
| 932 | 932 | $qb->select('alias1')->from(CmsUser::class, 'alias1'); |
| 933 | - $qb->join('alias1.articles','alias2'); |
|
| 933 | + $qb->join('alias1.articles', 'alias2'); |
|
| 934 | 934 | |
| 935 | 935 | $criteria = new Criteria(); |
| 936 | 936 | $criteria->where($criteria->expr()->eq('alias1.field', 'value1')); |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | { |
| 1047 | 1047 | $qb = $this->em->createQueryBuilder() |
| 1048 | 1048 | ->add('select', 'u') |
| 1049 | - ->add('from', CmsUser::class . ' u'); |
|
| 1049 | + ->add('from', CmsUser::class.' u'); |
|
| 1050 | 1050 | |
| 1051 | 1051 | self::assertEquals('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u', $qb->getDQL()); |
| 1052 | 1052 | } |
@@ -213,6 +213,7 @@ discard block |
||
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
| 216 | + * @param string|false $columnPrefix |
|
| 216 | 217 | * @return ClassMetadata |
| 217 | 218 | */ |
| 218 | 219 | private function generateIsbnEmbeddableFixture(array $embeddedClasses = [], $columnPrefix = null) |
@@ -1311,7 +1312,7 @@ discard block |
||
| 1311 | 1312 | |
| 1312 | 1313 | /** |
| 1313 | 1314 | * @param string $type |
| 1314 | - * @param \ReflectionProperty $method |
|
| 1315 | + * @param \ReflectionMethod $method |
|
| 1315 | 1316 | */ |
| 1316 | 1317 | private function assertPhpDocParamType($type, \ReflectionMethod $method) |
| 1317 | 1318 | { |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | $this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 678 | 678 | |
| 679 | 679 | $filename = $this->tmpDir . DIRECTORY_SEPARATOR |
| 680 | - . $this->namespace . DIRECTORY_SEPARATOR . 'DDC1784Entity.php'; |
|
| 680 | + . $this->namespace . DIRECTORY_SEPARATOR . 'DDC1784Entity.php'; |
|
| 681 | 681 | |
| 682 | 682 | self::assertFileExists($filename); |
| 683 | 683 | |
@@ -761,9 +761,9 @@ discard block |
||
| 761 | 761 | |
| 762 | 762 | } |
| 763 | 763 | |
| 764 | - /** |
|
| 765 | - * @group DDC-2172 |
|
| 766 | - */ |
|
| 764 | + /** |
|
| 765 | + * @group DDC-2172 |
|
| 766 | + */ |
|
| 767 | 767 | public function testGetInheritanceTypeString() |
| 768 | 768 | { |
| 769 | 769 | $reflection = new \ReflectionClass('\Doctrine\ORM\Mapping\ClassMetadata'); |
@@ -791,8 +791,8 @@ discard block |
||
| 791 | 791 | } |
| 792 | 792 | |
| 793 | 793 | /** |
| 794 | - * @group DDC-2172 |
|
| 795 | - */ |
|
| 794 | + * @group DDC-2172 |
|
| 795 | + */ |
|
| 796 | 796 | public function testGetChangeTrackingPolicyString() |
| 797 | 797 | { |
| 798 | 798 | $reflection = new \ReflectionClass('\Doctrine\ORM\Mapping\ClassMetadata'); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Doctrine\Tests\ORM\Tools; |
| 6 | 6 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $this->namespace = uniqid("doctrine_"); |
| 32 | 32 | $this->tmpDir = sys_get_temp_dir(); |
| 33 | 33 | |
| 34 | - mkdir($this->tmpDir . \DIRECTORY_SEPARATOR . $this->namespace); |
|
| 34 | + mkdir($this->tmpDir.\DIRECTORY_SEPARATOR.$this->namespace); |
|
| 35 | 35 | |
| 36 | 36 | $this->generator = new EntityGenerator(); |
| 37 | 37 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public function tearDown() |
| 46 | 46 | { |
| 47 | - $ri = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->tmpDir . '/' . $this->namespace)); |
|
| 47 | + $ri = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->tmpDir.'/'.$this->namespace)); |
|
| 48 | 48 | |
| 49 | 49 | foreach ($ri AS $file) { |
| 50 | 50 | /* @var $file \SplFileInfo */ |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - rmdir($this->tmpDir . '/' . $this->namespace); |
|
| 56 | + rmdir($this->tmpDir.'/'.$this->namespace); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function generateBookEntityFixture(array $embeddedClasses = []) |
| 65 | 65 | { |
| 66 | - $metadata = new ClassMetadata($this->namespace . '\EntityGeneratorBook'); |
|
| 66 | + $metadata = new ClassMetadata($this->namespace.'\EntityGeneratorBook'); |
|
| 67 | 67 | |
| 68 | - $metadata->setCustomRepositoryClassName($this->namespace . '\EntityGeneratorBookRepository'); |
|
| 68 | + $metadata->setCustomRepositoryClassName($this->namespace.'\EntityGeneratorBookRepository'); |
|
| 69 | 69 | |
| 70 | 70 | $tableMetadata = new Mapping\TableMetadata(); |
| 71 | 71 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | private function generateEntityTypeFixture(array $field) |
| 186 | 186 | { |
| 187 | - $metadata = new ClassMetadata($this->namespace . '\EntityType'); |
|
| 187 | + $metadata = new ClassMetadata($this->namespace.'\EntityType'); |
|
| 188 | 188 | |
| 189 | 189 | $tableMetadata = new Mapping\TableMetadata(); |
| 190 | 190 | $tableMetadata->setName('entity_type'); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | private function generateIsbnEmbeddableFixture(array $embeddedClasses = [], $columnPrefix = null) |
| 219 | 219 | { |
| 220 | - $metadata = new ClassMetadata($this->namespace . '\EntityGeneratorIsbn'); |
|
| 220 | + $metadata = new ClassMetadata($this->namespace.'\EntityGeneratorIsbn'); |
|
| 221 | 221 | $metadata->isEmbeddedClass = true; |
| 222 | 222 | |
| 223 | 223 | $fieldMetadata = new Mapping\FieldMetadata('prefix'); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | private function generateTestEmbeddableFixture() |
| 277 | 277 | { |
| 278 | - $metadata = new ClassMetadata($this->namespace . '\EntityGeneratorTestEmbeddable'); |
|
| 278 | + $metadata = new ClassMetadata($this->namespace.'\EntityGeneratorTestEmbeddable'); |
|
| 279 | 279 | |
| 280 | 280 | $metadata->isEmbeddedClass = true; |
| 281 | 281 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | private function loadEntityClass(ClassMetadata $metadata) |
| 319 | 319 | { |
| 320 | 320 | $className = basename(str_replace('\\', '/', $metadata->getClassName())); |
| 321 | - $path = $this->tmpDir . '/' . $this->namespace . '/' . $className . '.php'; |
|
| 321 | + $path = $this->tmpDir.'/'.$this->namespace.'/'.$className.'.php'; |
|
| 322 | 322 | |
| 323 | 323 | self::assertFileExists($path); |
| 324 | 324 | |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | |
| 470 | 470 | $this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 471 | 471 | |
| 472 | - self::assertFileExists($this->tmpDir . "/" . $this->namespace . "/EntityGeneratorBook.php~"); |
|
| 472 | + self::assertFileExists($this->tmpDir."/".$this->namespace."/EntityGeneratorBook.php~"); |
|
| 473 | 473 | |
| 474 | 474 | $book = $this->newInstance($metadata); |
| 475 | 475 | $reflClass = new \ReflectionClass($metadata->getClassName()); |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | */ |
| 622 | 622 | public function testMappedSuperclassAnnotationGeneration() |
| 623 | 623 | { |
| 624 | - $metadata = new ClassMetadata($this->namespace . '\EntityGeneratorBook'); |
|
| 624 | + $metadata = new ClassMetadata($this->namespace.'\EntityGeneratorBook'); |
|
| 625 | 625 | |
| 626 | 626 | $metadata->isMappedSuperclass = true; |
| 627 | 627 | |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | */ |
| 660 | 660 | public function testGenerateEntityWithSequenceGenerator() |
| 661 | 661 | { |
| 662 | - $metadata = new ClassMetadata($this->namespace . '\DDC1784Entity'); |
|
| 662 | + $metadata = new ClassMetadata($this->namespace.'\DDC1784Entity'); |
|
| 663 | 663 | |
| 664 | 664 | $fieldMetadata = new Mapping\FieldMetadata('id'); |
| 665 | 665 | $fieldMetadata->setType(Type::getType('integer')); |
@@ -676,8 +676,8 @@ discard block |
||
| 676 | 676 | |
| 677 | 677 | $this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 678 | 678 | |
| 679 | - $filename = $this->tmpDir . DIRECTORY_SEPARATOR |
|
| 680 | - . $this->namespace . DIRECTORY_SEPARATOR . 'DDC1784Entity.php'; |
|
| 679 | + $filename = $this->tmpDir.DIRECTORY_SEPARATOR |
|
| 680 | + . $this->namespace.DIRECTORY_SEPARATOR.'DDC1784Entity.php'; |
|
| 681 | 681 | |
| 682 | 682 | self::assertFileExists($filename); |
| 683 | 683 | |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | */ |
| 698 | 698 | public function testGenerateEntityWithMultipleInverseJoinColumns() |
| 699 | 699 | { |
| 700 | - $metadata = new ClassMetadata($this->namespace . '\DDC2079Entity'); |
|
| 700 | + $metadata = new ClassMetadata($this->namespace.'\DDC2079Entity'); |
|
| 701 | 701 | |
| 702 | 702 | $fieldMetadata = new Mapping\FieldMetadata('id'); |
| 703 | 703 | $fieldMetadata->setType(Type::getType('integer')); |
@@ -736,14 +736,14 @@ discard block |
||
| 736 | 736 | $association = new Mapping\ManyToManyAssociationMetadata('centroCustos'); |
| 737 | 737 | |
| 738 | 738 | $association->setJoinTable($joinTable); |
| 739 | - $association->setTargetEntity($this->namespace . '\\DDC2079CentroCusto'); |
|
| 739 | + $association->setTargetEntity($this->namespace.'\\DDC2079CentroCusto'); |
|
| 740 | 740 | |
| 741 | 741 | $metadata->addProperty($association); |
| 742 | 742 | |
| 743 | 743 | $this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 744 | 744 | |
| 745 | - $filename = $this->tmpDir . DIRECTORY_SEPARATOR |
|
| 746 | - . $this->namespace . DIRECTORY_SEPARATOR . 'DDC2079Entity.php'; |
|
| 745 | + $filename = $this->tmpDir.DIRECTORY_SEPARATOR |
|
| 746 | + . $this->namespace.DIRECTORY_SEPARATOR.'DDC2079Entity.php'; |
|
| 747 | 747 | |
| 748 | 748 | self::assertFileExists($filename); |
| 749 | 749 | |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | $method->setAccessible(true); |
| 775 | 775 | |
| 776 | 776 | foreach ($constants as $name => $value) { |
| 777 | - if( ! preg_match($pattern, $name)) { |
|
| 777 | + if ( ! preg_match($pattern, $name)) { |
|
| 778 | 778 | continue; |
| 779 | 779 | } |
| 780 | 780 | |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | $method->setAccessible(true); |
| 804 | 804 | |
| 805 | 805 | foreach ($constants as $name => $value) { |
| 806 | - if( ! preg_match($pattern, $name)) { |
|
| 806 | + if ( ! preg_match($pattern, $name)) { |
|
| 807 | 807 | continue; |
| 808 | 808 | } |
| 809 | 809 | |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | $method->setAccessible(true); |
| 833 | 833 | |
| 834 | 834 | foreach ($constants as $name => $value) { |
| 835 | - if( ! preg_match($pattern, $name)) { |
|
| 835 | + if ( ! preg_match($pattern, $name)) { |
|
| 836 | 836 | continue; |
| 837 | 837 | } |
| 838 | 838 | |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | public function testEntityTypeAlias(array $field) |
| 857 | 857 | { |
| 858 | 858 | $metadata = $this->generateEntityTypeFixture($field); |
| 859 | - $path = $this->tmpDir . '/'. $this->namespace . '/EntityType.php'; |
|
| 859 | + $path = $this->tmpDir.'/'.$this->namespace.'/EntityType.php'; |
|
| 860 | 860 | |
| 861 | 861 | self::assertFileExists($path); |
| 862 | 862 | require_once $path; |
@@ -869,8 +869,8 @@ discard block |
||
| 869 | 869 | $type = $field['phpType']; |
| 870 | 870 | $name = $field['fieldName']; |
| 871 | 871 | $value = $field['value']; |
| 872 | - $getter = "get" . ucfirst($name); |
|
| 873 | - $setter = "set" . ucfirst($name); |
|
| 872 | + $getter = "get".ucfirst($name); |
|
| 873 | + $setter = "set".ucfirst($name); |
|
| 874 | 874 | |
| 875 | 875 | self::assertPhpDocVarType($type, $reflClass->getProperty($name)); |
| 876 | 876 | self::assertPhpDocParamType($type, $reflClass->getMethod($setter)); |
@@ -893,13 +893,13 @@ discard block |
||
| 893 | 893 | $metadata = $cmf->getMetadataFor(get_class($user)); |
| 894 | 894 | |
| 895 | 895 | // @todo guilhermeblanco Fix this test as changing Entity class should never be allowed. |
| 896 | - $metadata->setClassName($this->namespace . "\DDC2372User"); |
|
| 896 | + $metadata->setClassName($this->namespace."\DDC2372User"); |
|
| 897 | 897 | |
| 898 | 898 | $this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 899 | 899 | |
| 900 | - self::assertFileExists($this->tmpDir . "/" . $this->namespace . "/DDC2372User.php"); |
|
| 900 | + self::assertFileExists($this->tmpDir."/".$this->namespace."/DDC2372User.php"); |
|
| 901 | 901 | |
| 902 | - require $this->tmpDir . "/" . $this->namespace . "/DDC2372User.php"; |
|
| 902 | + require $this->tmpDir."/".$this->namespace."/DDC2372User.php"; |
|
| 903 | 903 | |
| 904 | 904 | $reflClass = new \ReflectionClass($metadata->getClassName()); |
| 905 | 905 | |
@@ -921,12 +921,12 @@ discard block |
||
| 921 | 921 | $metadata = $cmf->getMetadataFor(get_class($user)); |
| 922 | 922 | |
| 923 | 923 | // @todo guilhermeblanco Fix this test as changing Entity class should never be allowed. |
| 924 | - $metadata->setClassName($this->namespace . "\DDC2372Admin"); |
|
| 924 | + $metadata->setClassName($this->namespace."\DDC2372Admin"); |
|
| 925 | 925 | |
| 926 | 926 | $this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 927 | 927 | |
| 928 | - self::assertFileExists($this->tmpDir . "/" . $this->namespace . "/DDC2372Admin.php"); |
|
| 929 | - require $this->tmpDir . "/" . $this->namespace . "/DDC2372Admin.php"; |
|
| 928 | + self::assertFileExists($this->tmpDir."/".$this->namespace."/DDC2372Admin.php"); |
|
| 929 | + require $this->tmpDir."/".$this->namespace."/DDC2372Admin.php"; |
|
| 930 | 930 | |
| 931 | 931 | $reflClass = new \ReflectionClass($metadata->getClassName()); |
| 932 | 932 | |
@@ -946,22 +946,22 @@ discard block |
||
| 946 | 946 | $cmf->setEntityManager($em); |
| 947 | 947 | |
| 948 | 948 | $ns = $this->namespace; |
| 949 | - $nsdir = $this->tmpDir . '/' . $ns; |
|
| 949 | + $nsdir = $this->tmpDir.'/'.$ns; |
|
| 950 | 950 | |
| 951 | 951 | // Dump DDC1590User into temp file |
| 952 | 952 | $content = str_replace( |
| 953 | 953 | 'namespace Doctrine\Tests\Models\DDC1590', |
| 954 | - 'namespace ' . $ns, |
|
| 955 | - file_get_contents(__DIR__ . '/../../Models/DDC1590/DDC1590User.php') |
|
| 954 | + 'namespace '.$ns, |
|
| 955 | + file_get_contents(__DIR__.'/../../Models/DDC1590/DDC1590User.php') |
|
| 956 | 956 | ); |
| 957 | 957 | |
| 958 | - $fname = $nsdir . "/DDC1590User.php"; |
|
| 958 | + $fname = $nsdir."/DDC1590User.php"; |
|
| 959 | 959 | file_put_contents($fname, $content); |
| 960 | 960 | |
| 961 | 961 | // Require DDC1590User |
| 962 | 962 | require $fname; |
| 963 | 963 | |
| 964 | - $metadata = $cmf->getMetadataFor($ns . '\DDC1590User'); |
|
| 964 | + $metadata = $cmf->getMetadataFor($ns.'\DDC1590User'); |
|
| 965 | 965 | $this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 966 | 966 | |
| 967 | 967 | // class DDC1590User extends DDC1590Entity { ... } |
@@ -969,13 +969,13 @@ discard block |
||
| 969 | 969 | |
| 970 | 970 | // class _DDC1590User extends DDC1590Entity { ... } |
| 971 | 971 | $source2 = str_replace('class DDC1590User', 'class _DDC1590User', $source); |
| 972 | - $fname2 = $nsdir . "/_DDC1590User.php"; |
|
| 972 | + $fname2 = $nsdir."/_DDC1590User.php"; |
|
| 973 | 973 | file_put_contents($fname2, $source2); |
| 974 | 974 | require $fname2; |
| 975 | 975 | |
| 976 | 976 | // class __DDC1590User { ... } |
| 977 | 977 | $source3 = str_replace('class DDC1590User extends DDC1590Entity', 'class __DDC1590User', $source); |
| 978 | - $fname3 = $nsdir . "/__DDC1590User.php"; |
|
| 978 | + $fname3 = $nsdir."/__DDC1590User.php"; |
|
| 979 | 979 | file_put_contents($fname3, $source3); |
| 980 | 980 | require $fname3; |
| 981 | 981 | |
@@ -1138,7 +1138,7 @@ discard block |
||
| 1138 | 1138 | $this->loadEntityClass($metadata); |
| 1139 | 1139 | |
| 1140 | 1140 | $className = basename(str_replace('\\', '/', $metadata->getClassName())); |
| 1141 | - $path = $this->tmpDir . '/' . $this->namespace . '/' . $className . '.php'; |
|
| 1141 | + $path = $this->tmpDir.'/'.$this->namespace.'/'.$className.'.php'; |
|
| 1142 | 1142 | $classTest = file_get_contents($path); |
| 1143 | 1143 | |
| 1144 | 1144 | $this->generator->setRegenerateEntityIfExists(true); |
@@ -1147,7 +1147,7 @@ discard block |
||
| 1147 | 1147 | $this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 1148 | 1148 | $classNew = file_get_contents($path); |
| 1149 | 1149 | |
| 1150 | - self::assertSame($classTest,$classNew); |
|
| 1150 | + self::assertSame($classTest, $classNew); |
|
| 1151 | 1151 | } |
| 1152 | 1152 | |
| 1153 | 1153 | /** |
@@ -57,6 +57,9 @@ discard block |
||
| 57 | 57 | return EntityManagerMock::create($connection, $config, $eventManager); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | + /** |
|
| 61 | + * @param string $path |
|
| 62 | + */ |
|
| 60 | 63 | protected function createMetadataDriver($type, $path) |
| 61 | 64 | { |
| 62 | 65 | $mappingDriver = [ |
@@ -75,6 +78,9 @@ discard block |
||
| 75 | 78 | return $driver; |
| 76 | 79 | } |
| 77 | 80 | |
| 81 | + /** |
|
| 82 | + * @param EntityManagerMock $em |
|
| 83 | + */ |
|
| 78 | 84 | protected function createClassMetadataFactory($em, $type) |
| 79 | 85 | { |
| 80 | 86 | $factory = ($type === 'annotation') |
@@ -294,7 +300,6 @@ discard block |
||
| 294 | 300 | |
| 295 | 301 | /** |
| 296 | 302 | * @depends testOneToManyAssociationsAreExported |
| 297 | - * @param ClassMetadata $metadata |
|
| 298 | 303 | */ |
| 299 | 304 | public function testManyToManyAssociationsAreExported($class) |
| 300 | 305 | { |
@@ -406,6 +411,9 @@ discard block |
||
| 406 | 411 | # $this->deleteDirectory(__DIR__ . '/export/'.$this->getType()); |
| 407 | 412 | } |
| 408 | 413 | |
| 414 | + /** |
|
| 415 | + * @param string $path |
|
| 416 | + */ |
|
| 409 | 417 | protected function deleteDirectory($path) |
| 410 | 418 | { |
| 411 | 419 | if (is_file($path)) { |
@@ -381,7 +381,7 @@ |
||
| 381 | 381 | |
| 382 | 382 | self::assertEquals('user', $property->getInversedBy()); |
| 383 | 383 | } |
| 384 | - /** |
|
| 384 | + /** |
|
| 385 | 385 | * @depends testExportDirectoryAndFilesAreCreated |
| 386 | 386 | */ |
| 387 | 387 | public function testCascadeAllCollapsed() |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Doctrine\Tests\ORM\Tools\Export; |
| 6 | 6 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $driverMock = new DriverMock(); |
| 45 | 45 | $config = new Configuration(); |
| 46 | 46 | |
| 47 | - $config->setProxyDir(__DIR__ . '/../../Proxies'); |
|
| 47 | + $config->setProxyDir(__DIR__.'/../../Proxies'); |
|
| 48 | 48 | $config->setProxyNamespace('Doctrine\Tests\Proxies'); |
| 49 | 49 | $eventManager = new EventManager(); |
| 50 | 50 | $conn = new ConnectionMock([], $driverMock, $config, $eventManager); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | 'xml' => XmlDriver::class, |
| 66 | 66 | ]; |
| 67 | 67 | |
| 68 | - self::assertArrayHasKey($type, $mappingDriver, "There is no metadata driver for the type '" . $type . "'."); |
|
| 68 | + self::assertArrayHasKey($type, $mappingDriver, "There is no metadata driver for the type '".$type."'."); |
|
| 69 | 69 | |
| 70 | 70 | $class = $mappingDriver[$type]; |
| 71 | 71 | $driver = ($type === 'annotation') |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | public function testExportDirectoryAndFilesAreCreated() |
| 90 | 90 | { |
| 91 | - $this->deleteDirectory(__DIR__ . '/export/'.$this->getType()); |
|
| 91 | + $this->deleteDirectory(__DIR__.'/export/'.$this->getType()); |
|
| 92 | 92 | |
| 93 | 93 | $type = $this->getType(); |
| 94 | - $metadataDriver = $this->createMetadataDriver($type, __DIR__ . '/' . $type); |
|
| 94 | + $metadataDriver = $this->createMetadataDriver($type, __DIR__.'/'.$type); |
|
| 95 | 95 | $em = $this->createEntityManager($metadataDriver); |
| 96 | 96 | $cmf = $this->createClassMetadataFactory($em, $type); |
| 97 | 97 | $metadata = $cmf->getAllMetadata(); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $type = $this->getType(); |
| 105 | 105 | $cme = new ClassMetadataExporter(); |
| 106 | - $exporter = $cme->getExporter($type, __DIR__ . '/export/' . $type); |
|
| 106 | + $exporter = $cme->getExporter($type, __DIR__.'/export/'.$type); |
|
| 107 | 107 | |
| 108 | 108 | if ($type === 'annotation') { |
| 109 | 109 | $exporter->setEntityGenerator(new EntityGenerator()); |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | $exporter->export(); |
| 116 | 116 | |
| 117 | 117 | if ($type == 'annotation') { |
| 118 | - self::assertTrue(file_exists(__DIR__ . '/export/' . $type . '/'.str_replace('\\', '/', ExportedUser::class).$this->extension)); |
|
| 118 | + self::assertTrue(file_exists(__DIR__.'/export/'.$type.'/'.str_replace('\\', '/', ExportedUser::class).$this->extension)); |
|
| 119 | 119 | } else { |
| 120 | - self::assertTrue(file_exists(__DIR__ . '/export/' . $type . '/Doctrine.Tests.ORM.Tools.Export.ExportedUser'.$this->extension)); |
|
| 120 | + self::assertTrue(file_exists(__DIR__.'/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser'.$this->extension)); |
|
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | $type = $this->getType(); |
| 130 | 130 | |
| 131 | - $metadataDriver = $this->createMetadataDriver($type, __DIR__ . '/export/' . $type); |
|
| 131 | + $metadataDriver = $this->createMetadataDriver($type, __DIR__.'/export/'.$type); |
|
| 132 | 132 | $em = $this->createEntityManager($metadataDriver); |
| 133 | 133 | $cmf = $this->createClassMetadataFactory($em, $type); |
| 134 | 134 | $metadata = $cmf->getAllMetadata(); |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | $type = $this->getType(); |
| 390 | 390 | |
| 391 | 391 | if ($type == 'xml') { |
| 392 | - $xml = simplexml_load_file(__DIR__ . '/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.xml'); |
|
| 392 | + $xml = simplexml_load_file(__DIR__.'/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.xml'); |
|
| 393 | 393 | |
| 394 | 394 | $xml->registerXPathNamespace("d", "http://doctrine-project.org/schemas/orm/doctrine-mapping"); |
| 395 | 395 | $nodes = $xml->xpath("/d:doctrine-mapping/d:entity/d:one-to-many[@field='interests']/d:cascade/d:*"); |
@@ -411,10 +411,10 @@ discard block |
||
| 411 | 411 | if (is_file($path)) { |
| 412 | 412 | return unlink($path); |
| 413 | 413 | } else if (is_dir($path)) { |
| 414 | - $files = glob(rtrim($path,'/').'/*'); |
|
| 414 | + $files = glob(rtrim($path, '/').'/*'); |
|
| 415 | 415 | |
| 416 | 416 | if (is_array($files)) { |
| 417 | - foreach ($files as $file){ |
|
| 417 | + foreach ($files as $file) { |
|
| 418 | 418 | $this->deleteDirectory($file); |
| 419 | 419 | } |
| 420 | 420 | } |