@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $driver = new DatabaseDriver($sm); |
| 41 | 41 | |
| 42 | 42 | foreach ($driver->getAllClassNames() as $className) { |
| 43 | - if (!in_array(strtolower($className), $classNames)) { |
|
| 43 | + if ( ! in_array(strtolower($className), $classNames)) { |
|
| 44 | 44 | continue; |
| 45 | 45 | } |
| 46 | 46 | $class = new ClassMetadataInfo($className); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if (count($metadatas) != count($classNames)) { |
| 52 | - $this->fail("Have not found all classes matching the names '" . implode(", ", $classNames) . "' only tables " . implode(", ", array_keys($metadatas))); |
|
| 52 | + $this->fail("Have not found all classes matching the names '".implode(", ", $classNames)."' only tables ".implode(", ", array_keys($metadatas))); |
|
| 53 | 53 | } |
| 54 | 54 | return $metadatas; |
| 55 | 55 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | private function registerType(string $className) |
| 36 | 36 | { |
| 37 | - $type = constant($className . '::NAME'); |
|
| 37 | + $type = constant($className.'::NAME'); |
|
| 38 | 38 | |
| 39 | 39 | if (DBALType::hasType($type)) { |
| 40 | 40 | DBALType::overrideType($type, $className); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | foreach ($classes as $class) { |
| 71 | 71 | $ce = $validator->validateClass($class); |
| 72 | 72 | |
| 73 | - $this->assertEmpty($ce, "Invalid Modelset: " . $modelSet . " class " . $class->name . ": ". implode("\n", $ce)); |
|
| 73 | + $this->assertEmpty($ce, "Invalid Modelset: ".$modelSet." class ".$class->name.": ".implode("\n", $ce)); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -232,8 +232,8 @@ discard block |
||
| 232 | 232 | $eventManager->addEventListener([Events::postLoad], $listener); |
| 233 | 233 | |
| 234 | 234 | $this->_em->find(CmsUser::class, $this->userId); |
| 235 | - $this->assertSame(1, $listener->countHandledEvents(CmsUser::class), CmsUser::class . ' should be handled once!'); |
|
| 236 | - $this->assertSame(1, $listener->countHandledEvents(CmsEmail::class), CmsEmail::class . ' should be handled once!'); |
|
| 235 | + $this->assertSame(1, $listener->countHandledEvents(CmsUser::class), CmsUser::class.' should be handled once!'); |
|
| 236 | + $this->assertSame(1, $listener->countHandledEvents(CmsEmail::class), CmsEmail::class.' should be handled once!'); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | private function loadFixture() |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | { |
| 310 | 310 | $object = $event->getObject(); |
| 311 | 311 | $class = ClassUtils::getClass($object); |
| 312 | - if (!isset($this->firedByClasses[$class])) { |
|
| 312 | + if ( ! isset($this->firedByClasses[$class])) { |
|
| 313 | 313 | $this->firedByClasses[$class] = 1; |
| 314 | 314 | } else { |
| 315 | 315 | $this->firedByClasses[$class]++; |
@@ -34,37 +34,37 @@ |
||
| 34 | 34 | $dql = "SELECT u FROM Doctrine\Tests\Models\Cms\CmsUser u"; |
| 35 | 35 | |
| 36 | 36 | $users = $this->_em->createQuery($dql) |
| 37 | - ->setHydrationCacheProfile(new QueryCacheProfile(null, null, $cache)) |
|
| 38 | - ->getResult(); |
|
| 37 | + ->setHydrationCacheProfile(new QueryCacheProfile(null, null, $cache)) |
|
| 38 | + ->getResult(); |
|
| 39 | 39 | |
| 40 | 40 | $c = $this->getCurrentQueryCount(); |
| 41 | 41 | $users = $this->_em->createQuery($dql) |
| 42 | - ->setHydrationCacheProfile(new QueryCacheProfile(null, null, $cache)) |
|
| 43 | - ->getResult(); |
|
| 42 | + ->setHydrationCacheProfile(new QueryCacheProfile(null, null, $cache)) |
|
| 43 | + ->getResult(); |
|
| 44 | 44 | |
| 45 | 45 | $this->assertEquals($c, $this->getCurrentQueryCount(), "Should not execute query. Its cached!"); |
| 46 | 46 | |
| 47 | 47 | $users = $this->_em->createQuery($dql) |
| 48 | - ->setHydrationCacheProfile(new QueryCacheProfile(null, null, $cache)) |
|
| 49 | - ->getArrayResult(); |
|
| 48 | + ->setHydrationCacheProfile(new QueryCacheProfile(null, null, $cache)) |
|
| 49 | + ->getArrayResult(); |
|
| 50 | 50 | |
| 51 | 51 | $this->assertEquals($c + 1, $this->getCurrentQueryCount(), "Hydration is part of cache key."); |
| 52 | 52 | |
| 53 | 53 | $users = $this->_em->createQuery($dql) |
| 54 | - ->setHydrationCacheProfile(new QueryCacheProfile(null, null, $cache)) |
|
| 55 | - ->getArrayResult(); |
|
| 54 | + ->setHydrationCacheProfile(new QueryCacheProfile(null, null, $cache)) |
|
| 55 | + ->getArrayResult(); |
|
| 56 | 56 | |
| 57 | 57 | $this->assertEquals($c + 1, $this->getCurrentQueryCount(), "Hydration now cached"); |
| 58 | 58 | |
| 59 | 59 | $users = $this->_em->createQuery($dql) |
| 60 | - ->setHydrationCacheProfile(new QueryCacheProfile(null, 'cachekey', $cache)) |
|
| 61 | - ->getArrayResult(); |
|
| 60 | + ->setHydrationCacheProfile(new QueryCacheProfile(null, 'cachekey', $cache)) |
|
| 61 | + ->getArrayResult(); |
|
| 62 | 62 | |
| 63 | 63 | $this->assertTrue($cache->contains('cachekey'), 'Explicit cache key'); |
| 64 | 64 | |
| 65 | 65 | $users = $this->_em->createQuery($dql) |
| 66 | - ->setHydrationCacheProfile(new QueryCacheProfile(null, 'cachekey', $cache)) |
|
| 67 | - ->getArrayResult(); |
|
| 66 | + ->setHydrationCacheProfile(new QueryCacheProfile(null, 'cachekey', $cache)) |
|
| 67 | + ->getArrayResult(); |
|
| 68 | 68 | $this->assertEquals($c + 2, $this->getCurrentQueryCount(), "Hydration now cached"); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $this->_em->clear(); |
| 51 | 51 | |
| 52 | - $result2 = $this->_em->createQuery($dql) |
|
| 52 | + $result2 = $this->_em->createQuery($dql) |
|
| 53 | 53 | ->setCacheable(true) |
| 54 | 54 | ->getResult(); |
| 55 | 55 | |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | $this->_em->clear(); |
| 254 | 254 | |
| 255 | - $result2 = $this->_em->createQuery($dql) |
|
| 255 | + $result2 = $this->_em->createQuery($dql) |
|
| 256 | 256 | ->setCacheable(true) |
| 257 | 257 | ->getResult(); |
| 258 | 258 | |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | |
| 345 | 345 | $this->_em->clear(); |
| 346 | 346 | |
| 347 | - $result2 = $this->_em->createQuery($dql) |
|
| 347 | + $result2 = $this->_em->createQuery($dql) |
|
| 348 | 348 | ->setCacheable(true) |
| 349 | 349 | ->getResult(); |
| 350 | 350 | |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | |
| 393 | 393 | $this->_em->clear(); |
| 394 | 394 | |
| 395 | - $result2 = $this->_em->createQuery($dql)->setCacheable(true) |
|
| 395 | + $result2 = $this->_em->createQuery($dql)->setCacheable(true) |
|
| 396 | 396 | ->setParameter('name', $name) |
| 397 | 397 | ->getResult(); |
| 398 | 398 | |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | $result1 = $this->_em->createQuery($dql)->setCacheable(true)->getResult(); |
| 421 | 421 | |
| 422 | 422 | $this->assertCount(2, $result1); |
| 423 | - $this->assertEquals($queryCount + 1 , $this->getCurrentQueryCount()); |
|
| 423 | + $this->assertEquals($queryCount + 1, $this->getCurrentQueryCount()); |
|
| 424 | 424 | $this->assertEquals($this->countries[0]->getId(), $result1[0]->getId()); |
| 425 | 425 | $this->assertEquals($this->countries[1]->getId(), $result1[1]->getId()); |
| 426 | 426 | $this->assertEquals($this->countries[0]->getName(), $result1[0]->getName()); |
@@ -436,11 +436,11 @@ discard block |
||
| 436 | 436 | |
| 437 | 437 | $this->_em->clear(); |
| 438 | 438 | |
| 439 | - $result2 = $this->_em->createQuery($dql) |
|
| 439 | + $result2 = $this->_em->createQuery($dql) |
|
| 440 | 440 | ->setCacheable(true) |
| 441 | 441 | ->getResult(); |
| 442 | 442 | |
| 443 | - $this->assertEquals($queryCount + 2 , $this->getCurrentQueryCount()); |
|
| 443 | + $this->assertEquals($queryCount + 2, $this->getCurrentQueryCount()); |
|
| 444 | 444 | $this->assertCount(2, $result2); |
| 445 | 445 | |
| 446 | 446 | $this->assertEquals(5, $this->secondLevelCacheLogger->getPutCount()); |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | $this->assertEquals($result1[0]->getName(), $result2[0]->getName()); |
| 458 | 458 | $this->assertEquals($result1[1]->getName(), $result2[1]->getName()); |
| 459 | 459 | |
| 460 | - $this->assertEquals($queryCount + 2 , $this->getCurrentQueryCount()); |
|
| 460 | + $this->assertEquals($queryCount + 2, $this->getCurrentQueryCount()); |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | public function testBasicQueryFetchJoinsOneToMany() |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | |
| 499 | 499 | $this->_em->clear(); |
| 500 | 500 | |
| 501 | - $result2 = $this->_em->createQuery($dql) |
|
| 501 | + $result2 = $this->_em->createQuery($dql) |
|
| 502 | 502 | ->setCacheable(true) |
| 503 | 503 | ->getResult(); |
| 504 | 504 | |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | $this->_em->clear(); |
| 565 | 565 | $this->secondLevelCacheLogger->clearStats(); |
| 566 | 566 | |
| 567 | - $result2 = $this->_em->createQuery($dql) |
|
| 567 | + $result2 = $this->_em->createQuery($dql) |
|
| 568 | 568 | ->setCacheable(true) |
| 569 | 569 | ->getResult(); |
| 570 | 570 | |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | |
| 625 | 625 | $this->cache->evictEntityRegion(State::class); |
| 626 | 626 | |
| 627 | - $result2 = $this->_em->createQuery($dql) |
|
| 627 | + $result2 = $this->_em->createQuery($dql) |
|
| 628 | 628 | ->setCacheable(true) |
| 629 | 629 | ->getResult(); |
| 630 | 630 | |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | |
| 668 | 668 | $this->cache->evictEntityRegion(City::class); |
| 669 | 669 | |
| 670 | - $result2 = $this->_em->createQuery($dql) |
|
| 670 | + $result2 = $this->_em->createQuery($dql) |
|
| 671 | 671 | ->setCacheable(true) |
| 672 | 672 | ->getResult(); |
| 673 | 673 | |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | |
| 719 | 719 | $this->_em->clear(); |
| 720 | 720 | |
| 721 | - $result2 = $this->_em->createNativeQuery($sql, $rsm) |
|
| 721 | + $result2 = $this->_em->createNativeQuery($sql, $rsm) |
|
| 722 | 722 | ->setCacheable(true) |
| 723 | 723 | ->getResult(); |
| 724 | 724 | |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | |
| 774 | 774 | $this->_em->clear(); |
| 775 | 775 | |
| 776 | - $result2 = $this->_em->createQuery($dql) |
|
| 776 | + $result2 = $this->_em->createQuery($dql) |
|
| 777 | 777 | ->setCacheable(true) |
| 778 | 778 | ->setFirstResult(2) |
| 779 | 779 | ->setMaxResults(1) |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | |
| 786 | 786 | $this->_em->clear(); |
| 787 | 787 | |
| 788 | - $result3 = $this->_em->createQuery($dql) |
|
| 788 | + $result3 = $this->_em->createQuery($dql) |
|
| 789 | 789 | ->setCacheable(true) |
| 790 | 790 | ->getResult(); |
| 791 | 791 | |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | $this->secondLevelCacheLogger->clearStats(); |
| 803 | 803 | $this->_em->clear(); |
| 804 | 804 | |
| 805 | - $getHash = function(AbstractQuery $query){ |
|
| 805 | + $getHash = function(AbstractQuery $query) { |
|
| 806 | 806 | $method = new \ReflectionMethod($query, 'getHash'); |
| 807 | 807 | $method->setAccessible(true); |
| 808 | 808 | |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | ->getRegion() |
| 836 | 836 | ->put($key, $entry); |
| 837 | 837 | |
| 838 | - $result2 = $this->_em->createQuery($dql) |
|
| 838 | + $result2 = $this->_em->createQuery($dql) |
|
| 839 | 839 | ->setCacheable(true) |
| 840 | 840 | ->setLifetime(3600) |
| 841 | 841 | ->getResult(); |
@@ -160,9 +160,9 @@ |
||
| 160 | 160 | */ |
| 161 | 161 | private $other2; |
| 162 | 162 | |
| 163 | - public function getId() {return $this->id;} |
|
| 164 | - public function setOther1($other1) {$this->other1 = $other1;} |
|
| 165 | - public function getOther1() {return $this->other1;} |
|
| 166 | - public function setOther2($other2) {$this->other2 = $other2;} |
|
| 167 | - public function getOther2() {return $this->other2;} |
|
| 163 | + public function getId() {return $this->id; } |
|
| 164 | + public function setOther1($other1) {$this->other1 = $other1; } |
|
| 165 | + public function getOther1() {return $this->other1; } |
|
| 166 | + public function setOther2($other2) {$this->other2 = $other2; } |
|
| 167 | + public function getOther2() {return $this->other2; } |
|
| 168 | 168 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | use Doctrine\Tests\Models\CMS\CmsUser; |
| 12 | 12 | use Doctrine\Tests\OrmFunctionalTestCase; |
| 13 | 13 | |
| 14 | -require_once __DIR__ . '/../../TestInit.php'; |
|
| 14 | +require_once __DIR__.'/../../TestInit.php'; |
|
| 15 | 15 | |
| 16 | 16 | class CustomFunctionsTest extends OrmFunctionalTestCase |
| 17 | 17 | { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | try { |
| 74 | 74 | $this->schemaTool->createSchema($classMetadata); |
| 75 | - } catch(\Exception $e) { |
|
| 75 | + } catch (\Exception $e) { |
|
| 76 | 76 | // was already created |
| 77 | 77 | } |
| 78 | 78 | |
@@ -87,6 +87,6 @@ discard block |
||
| 87 | 87 | $sql = $schemaDiff->toSql($this->_em->getConnection()->getDatabasePlatform()); |
| 88 | 88 | $sql = array_filter($sql, function($sql) { return strpos($sql, 'DROP') === false; }); |
| 89 | 89 | |
| 90 | - $this->assertEquals(0, count($sql), "SQL: " . implode(PHP_EOL, $sql)); |
|
| 90 | + $this->assertEquals(0, count($sql), "SQL: ".implode(PHP_EOL, $sql)); |
|
| 91 | 91 | } |
| 92 | 92 | } |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | */ |
| 57 | 57 | public function testDropPartSchemaWithForeignKeys() |
| 58 | 58 | { |
| 59 | - if (!$this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) { |
|
| 59 | + if ( ! $this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) { |
|
| 60 | 60 | $this->markTestSkipped("Foreign Key test"); |
| 61 | 61 | } |
| 62 | 62 | |