@@ -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, |
@@ -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'); |
@@ -17,7 +17,6 @@ |
||
| 17 | 17 | use Doctrine\Tests\Models\DDC2372\DDC2372Admin; |
| 18 | 18 | use Doctrine\Tests\Models\DDC2372\DDC2372User; |
| 19 | 19 | use Doctrine\Tests\OrmTestCase; |
| 20 | -use SebastianBergmann\Environment\Runtime; |
|
| 21 | 20 | |
| 22 | 21 | class EntityGeneratorTest extends OrmTestCase |
| 23 | 22 | { |
@@ -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 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $this->namespace = uniqid("doctrine_", false); |
| 54 | 54 | $this->tmpDir = sys_get_temp_dir(); |
| 55 | 55 | |
| 56 | - mkdir($this->tmpDir . \DIRECTORY_SEPARATOR . $this->namespace); |
|
| 56 | + mkdir($this->tmpDir.\DIRECTORY_SEPARATOR.$this->namespace); |
|
| 57 | 57 | |
| 58 | 58 | $this->generator = new EntityGenerator(); |
| 59 | 59 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | public function tearDown() |
| 68 | 68 | { |
| 69 | - $ri = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->tmpDir . '/' . $this->namespace)); |
|
| 69 | + $ri = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->tmpDir.'/'.$this->namespace)); |
|
| 70 | 70 | |
| 71 | 71 | foreach ($ri AS $file) { |
| 72 | 72 | /* @var $file \SplFileInfo */ |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - rmdir($this->tmpDir . '/' . $this->namespace); |
|
| 78 | + rmdir($this->tmpDir.'/'.$this->namespace); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function generateBookEntityFixture(array $embeddedClasses = []) |
| 87 | 87 | { |
| 88 | - $metadata = new ClassMetadata($this->namespace . '\EntityGeneratorBook', $this->staticMetadataBuildingContext); |
|
| 88 | + $metadata = new ClassMetadata($this->namespace.'\EntityGeneratorBook', $this->staticMetadataBuildingContext); |
|
| 89 | 89 | |
| 90 | - $metadata->setCustomRepositoryClassName($this->namespace . '\EntityGeneratorBookRepository'); |
|
| 90 | + $metadata->setCustomRepositoryClassName($this->namespace.'\EntityGeneratorBookRepository'); |
|
| 91 | 91 | |
| 92 | 92 | $tableMetadata = new Mapping\TableMetadata(); |
| 93 | 93 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | private function generateEntityTypeFixture(array $field) |
| 208 | 208 | { |
| 209 | - $metadata = new ClassMetadata($this->namespace . '\EntityType', $this->staticMetadataBuildingContext); |
|
| 209 | + $metadata = new ClassMetadata($this->namespace.'\EntityType', $this->staticMetadataBuildingContext); |
|
| 210 | 210 | |
| 211 | 211 | $tableMetadata = new Mapping\TableMetadata(); |
| 212 | 212 | $tableMetadata->setName('entity_type'); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | private function generateIsbnEmbeddableFixture(array $embeddedClasses = [], $columnPrefix = null) |
| 241 | 241 | { |
| 242 | - $metadata = new ClassMetadata($this->namespace . '\EntityGeneratorIsbn', $this->staticMetadataBuildingContext); |
|
| 242 | + $metadata = new ClassMetadata($this->namespace.'\EntityGeneratorIsbn', $this->staticMetadataBuildingContext); |
|
| 243 | 243 | |
| 244 | 244 | $metadata->isEmbeddedClass = true; |
| 245 | 245 | |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | */ |
| 299 | 299 | private function generateTestEmbeddableFixture() |
| 300 | 300 | { |
| 301 | - $metadata = new ClassMetadata($this->namespace . '\EntityGeneratorTestEmbeddable', $this->staticMetadataBuildingContext); |
|
| 301 | + $metadata = new ClassMetadata($this->namespace.'\EntityGeneratorTestEmbeddable', $this->staticMetadataBuildingContext); |
|
| 302 | 302 | |
| 303 | 303 | $metadata->isEmbeddedClass = true; |
| 304 | 304 | |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | private function loadEntityClass(ClassMetadata $metadata) |
| 342 | 342 | { |
| 343 | 343 | $className = basename(str_replace('\\', '/', $metadata->getClassName())); |
| 344 | - $path = $this->tmpDir . '/' . $this->namespace . '/' . $className . '.php'; |
|
| 344 | + $path = $this->tmpDir.'/'.$this->namespace.'/'.$className.'.php'; |
|
| 345 | 345 | |
| 346 | 346 | self::assertFileExists($path); |
| 347 | 347 | |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | |
| 493 | 493 | $this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 494 | 494 | |
| 495 | - self::assertFileExists($this->tmpDir . "/" . $this->namespace . "/EntityGeneratorBook.php~"); |
|
| 495 | + self::assertFileExists($this->tmpDir."/".$this->namespace."/EntityGeneratorBook.php~"); |
|
| 496 | 496 | |
| 497 | 497 | $book = $this->newInstance($metadata); |
| 498 | 498 | $reflClass = new \ReflectionClass($metadata->getClassName()); |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | self::assertPhpDocReturnType('\Doctrine\Tests\ORM\Tools\EntityGeneratorAuthor|null', new \ReflectionMethod($book, 'getAuthor')); |
| 544 | 544 | self::assertPhpDocParamType('\Doctrine\Tests\ORM\Tools\EntityGeneratorAuthor|null', new \ReflectionMethod($book, 'setAuthor')); |
| 545 | 545 | |
| 546 | - $expectedClassName = '\\' . $embeddedMetadata->getClassName(); |
|
| 546 | + $expectedClassName = '\\'.$embeddedMetadata->getClassName(); |
|
| 547 | 547 | |
| 548 | 548 | self::assertPhpDocVarType($expectedClassName, new \ReflectionProperty($book, 'isbn')); |
| 549 | 549 | self::assertPhpDocReturnType($expectedClassName, new \ReflectionMethod($book, 'getIsbn')); |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | */ |
| 648 | 648 | public function testMappedSuperclassAnnotationGeneration() |
| 649 | 649 | { |
| 650 | - $metadata = new ClassMetadata($this->namespace . '\EntityGeneratorBook', $this->staticMetadataBuildingContext); |
|
| 650 | + $metadata = new ClassMetadata($this->namespace.'\EntityGeneratorBook', $this->staticMetadataBuildingContext); |
|
| 651 | 651 | |
| 652 | 652 | $metadata->isMappedSuperclass = true; |
| 653 | 653 | |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | */ |
| 685 | 685 | public function testGenerateEntityWithSequenceGenerator() |
| 686 | 686 | { |
| 687 | - $metadata = new ClassMetadata($this->namespace . '\DDC1784Entity', $this->staticMetadataBuildingContext); |
|
| 687 | + $metadata = new ClassMetadata($this->namespace.'\DDC1784Entity', $this->staticMetadataBuildingContext); |
|
| 688 | 688 | $metadata->setTable(new Mapping\TableMetadata('ddc1784_entity')); |
| 689 | 689 | |
| 690 | 690 | $fieldMetadata = new Mapping\FieldMetadata('id'); |
@@ -702,8 +702,8 @@ discard block |
||
| 702 | 702 | |
| 703 | 703 | $this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 704 | 704 | |
| 705 | - $filename = $this->tmpDir . DIRECTORY_SEPARATOR |
|
| 706 | - . $this->namespace . DIRECTORY_SEPARATOR . 'DDC1784Entity.php'; |
|
| 705 | + $filename = $this->tmpDir.DIRECTORY_SEPARATOR |
|
| 706 | + . $this->namespace.DIRECTORY_SEPARATOR.'DDC1784Entity.php'; |
|
| 707 | 707 | |
| 708 | 708 | self::assertFileExists($filename); |
| 709 | 709 | |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | */ |
| 724 | 724 | public function testGenerateEntityWithMultipleInverseJoinColumns() |
| 725 | 725 | { |
| 726 | - $metadata = new ClassMetadata($this->namespace . '\DDC2079Entity', $this->staticMetadataBuildingContext); |
|
| 726 | + $metadata = new ClassMetadata($this->namespace.'\DDC2079Entity', $this->staticMetadataBuildingContext); |
|
| 727 | 727 | $metadata->setTable(new Mapping\TableMetadata('ddc2079_entity')); |
| 728 | 728 | |
| 729 | 729 | $fieldMetadata = new Mapping\FieldMetadata('id'); |
@@ -763,14 +763,14 @@ discard block |
||
| 763 | 763 | $association = new Mapping\ManyToManyAssociationMetadata('centroCustos'); |
| 764 | 764 | |
| 765 | 765 | $association->setJoinTable($joinTable); |
| 766 | - $association->setTargetEntity($this->namespace . '\\DDC2079CentroCusto'); |
|
| 766 | + $association->setTargetEntity($this->namespace.'\\DDC2079CentroCusto'); |
|
| 767 | 767 | |
| 768 | 768 | $metadata->addProperty($association); |
| 769 | 769 | |
| 770 | 770 | $this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 771 | 771 | |
| 772 | - $filename = $this->tmpDir . DIRECTORY_SEPARATOR |
|
| 773 | - . $this->namespace . DIRECTORY_SEPARATOR . 'DDC2079Entity.php'; |
|
| 772 | + $filename = $this->tmpDir.DIRECTORY_SEPARATOR |
|
| 773 | + . $this->namespace.DIRECTORY_SEPARATOR.'DDC2079Entity.php'; |
|
| 774 | 774 | |
| 775 | 775 | self::assertFileExists($filename); |
| 776 | 776 | |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | $method->setAccessible(true); |
| 802 | 802 | |
| 803 | 803 | foreach ($constants as $name => $value) { |
| 804 | - if( ! preg_match($pattern, $name)) { |
|
| 804 | + if ( ! preg_match($pattern, $name)) { |
|
| 805 | 805 | continue; |
| 806 | 806 | } |
| 807 | 807 | |
@@ -830,7 +830,7 @@ discard block |
||
| 830 | 830 | $method->setAccessible(true); |
| 831 | 831 | |
| 832 | 832 | foreach ($constants as $name => $value) { |
| 833 | - if( ! preg_match($pattern, $name)) { |
|
| 833 | + if ( ! preg_match($pattern, $name)) { |
|
| 834 | 834 | continue; |
| 835 | 835 | } |
| 836 | 836 | |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | $method->setAccessible(true); |
| 860 | 860 | |
| 861 | 861 | foreach ($constants as $name => $value) { |
| 862 | - if( ! preg_match($pattern, $name)) { |
|
| 862 | + if ( ! preg_match($pattern, $name)) { |
|
| 863 | 863 | continue; |
| 864 | 864 | } |
| 865 | 865 | |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | public function testEntityTypeAlias(array $field) |
| 884 | 884 | { |
| 885 | 885 | $metadata = $this->generateEntityTypeFixture($field); |
| 886 | - $path = $this->tmpDir . '/'. $this->namespace . '/EntityType.php'; |
|
| 886 | + $path = $this->tmpDir.'/'.$this->namespace.'/EntityType.php'; |
|
| 887 | 887 | |
| 888 | 888 | self::assertFileExists($path); |
| 889 | 889 | require_once $path; |
@@ -896,8 +896,8 @@ discard block |
||
| 896 | 896 | $type = $field['phpType']; |
| 897 | 897 | $name = $field['fieldName']; |
| 898 | 898 | $value = $field['value']; |
| 899 | - $getter = "get" . ucfirst($name); |
|
| 900 | - $setter = "set" . ucfirst($name); |
|
| 899 | + $getter = "get".ucfirst($name); |
|
| 900 | + $setter = "set".ucfirst($name); |
|
| 901 | 901 | |
| 902 | 902 | self::assertPhpDocVarType($type, $reflClass->getProperty($name)); |
| 903 | 903 | self::assertPhpDocParamType($type, $reflClass->getMethod($setter)); |
@@ -920,13 +920,13 @@ discard block |
||
| 920 | 920 | $metadata = $cmf->getMetadataFor(get_class($user)); |
| 921 | 921 | |
| 922 | 922 | // @todo guilhermeblanco Fix this test as changing Entity class should never be allowed. |
| 923 | - $metadata->setClassName($this->namespace . "\DDC2372User"); |
|
| 923 | + $metadata->setClassName($this->namespace."\DDC2372User"); |
|
| 924 | 924 | |
| 925 | 925 | $this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 926 | 926 | |
| 927 | - self::assertFileExists($this->tmpDir . "/" . $this->namespace . "/DDC2372User.php"); |
|
| 927 | + self::assertFileExists($this->tmpDir."/".$this->namespace."/DDC2372User.php"); |
|
| 928 | 928 | |
| 929 | - require $this->tmpDir . "/" . $this->namespace . "/DDC2372User.php"; |
|
| 929 | + require $this->tmpDir."/".$this->namespace."/DDC2372User.php"; |
|
| 930 | 930 | |
| 931 | 931 | $reflClass = new \ReflectionClass($metadata->getClassName()); |
| 932 | 932 | |
@@ -948,12 +948,12 @@ discard block |
||
| 948 | 948 | $metadata = $cmf->getMetadataFor(get_class($user)); |
| 949 | 949 | |
| 950 | 950 | // @todo guilhermeblanco Fix this test as changing Entity class should never be allowed. |
| 951 | - $metadata->setClassName($this->namespace . "\DDC2372Admin"); |
|
| 951 | + $metadata->setClassName($this->namespace."\DDC2372Admin"); |
|
| 952 | 952 | |
| 953 | 953 | $this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 954 | 954 | |
| 955 | - self::assertFileExists($this->tmpDir . "/" . $this->namespace . "/DDC2372Admin.php"); |
|
| 956 | - require $this->tmpDir . "/" . $this->namespace . "/DDC2372Admin.php"; |
|
| 955 | + self::assertFileExists($this->tmpDir."/".$this->namespace."/DDC2372Admin.php"); |
|
| 956 | + require $this->tmpDir."/".$this->namespace."/DDC2372Admin.php"; |
|
| 957 | 957 | |
| 958 | 958 | $reflClass = new \ReflectionClass($metadata->getClassName()); |
| 959 | 959 | |
@@ -973,22 +973,22 @@ discard block |
||
| 973 | 973 | $cmf->setEntityManager($em); |
| 974 | 974 | |
| 975 | 975 | $ns = $this->namespace; |
| 976 | - $nsdir = $this->tmpDir . '/' . $ns; |
|
| 976 | + $nsdir = $this->tmpDir.'/'.$ns; |
|
| 977 | 977 | |
| 978 | 978 | // Dump DDC1590User into temp file |
| 979 | 979 | $content = str_replace( |
| 980 | 980 | 'namespace Doctrine\Tests\Models\DDC1590', |
| 981 | - 'namespace ' . $ns, |
|
| 982 | - file_get_contents(__DIR__ . '/../../Models/DDC1590/DDC1590User.php') |
|
| 981 | + 'namespace '.$ns, |
|
| 982 | + file_get_contents(__DIR__.'/../../Models/DDC1590/DDC1590User.php') |
|
| 983 | 983 | ); |
| 984 | 984 | |
| 985 | - $fname = $nsdir . "/DDC1590User.php"; |
|
| 985 | + $fname = $nsdir."/DDC1590User.php"; |
|
| 986 | 986 | file_put_contents($fname, $content); |
| 987 | 987 | |
| 988 | 988 | // Require DDC1590User |
| 989 | 989 | require $fname; |
| 990 | 990 | |
| 991 | - $metadata = $cmf->getMetadataFor($ns . '\DDC1590User'); |
|
| 991 | + $metadata = $cmf->getMetadataFor($ns.'\DDC1590User'); |
|
| 992 | 992 | $this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 993 | 993 | |
| 994 | 994 | // class DDC1590User extends DDC1590Entity { ... } |
@@ -996,13 +996,13 @@ discard block |
||
| 996 | 996 | |
| 997 | 997 | // class _DDC1590User extends DDC1590Entity { ... } |
| 998 | 998 | $source2 = str_replace('class DDC1590User', 'class _DDC1590User', $source); |
| 999 | - $fname2 = $nsdir . "/_DDC1590User.php"; |
|
| 999 | + $fname2 = $nsdir."/_DDC1590User.php"; |
|
| 1000 | 1000 | file_put_contents($fname2, $source2); |
| 1001 | 1001 | require $fname2; |
| 1002 | 1002 | |
| 1003 | 1003 | // class __DDC1590User { ... } |
| 1004 | 1004 | $source3 = str_replace('class DDC1590User extends DDC1590Entity', 'class __DDC1590User', $source); |
| 1005 | - $fname3 = $nsdir . "/__DDC1590User.php"; |
|
| 1005 | + $fname3 = $nsdir."/__DDC1590User.php"; |
|
| 1006 | 1006 | file_put_contents($fname3, $source3); |
| 1007 | 1007 | require $fname3; |
| 1008 | 1008 | |
@@ -1165,7 +1165,7 @@ discard block |
||
| 1165 | 1165 | $this->loadEntityClass($metadata); |
| 1166 | 1166 | |
| 1167 | 1167 | $className = basename(str_replace('\\', '/', $metadata->getClassName())); |
| 1168 | - $path = $this->tmpDir . '/' . $this->namespace . '/' . $className . '.php'; |
|
| 1168 | + $path = $this->tmpDir.'/'.$this->namespace.'/'.$className.'.php'; |
|
| 1169 | 1169 | $classTest = file_get_contents($path); |
| 1170 | 1170 | |
| 1171 | 1171 | $this->generator->setRegenerateEntityIfExists(true); |
@@ -1174,7 +1174,7 @@ discard block |
||
| 1174 | 1174 | $this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 1175 | 1175 | $classNew = file_get_contents($path); |
| 1176 | 1176 | |
| 1177 | - self::assertSame($classTest,$classNew); |
|
| 1177 | + self::assertSame($classTest, $classNew); |
|
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | 1180 | /** |
@@ -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() |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | use Doctrine\ORM\Mapping\ClassMetadata; |
| 13 | 13 | use Doctrine\ORM\Mapping\Driver\AnnotationDriver; |
| 14 | 14 | use Doctrine\ORM\Mapping\Driver\XmlDriver; |
| 15 | -use Doctrine\ORM\Mapping\Driver\PHPDriver; |
|
| 16 | 15 | use Doctrine\ORM\Mapping\ManyToManyAssociationMetadata; |
| 17 | 16 | use Doctrine\ORM\Mapping\OneToManyAssociationMetadata; |
| 18 | 17 | use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory; |
@@ -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); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | 'xml' => XmlDriver::class, |
| 65 | 65 | ]; |
| 66 | 66 | |
| 67 | - self::assertArrayHasKey($type, $mappingDriver, "There is no metadata driver for the type '" . $type . "'."); |
|
| 67 | + self::assertArrayHasKey($type, $mappingDriver, "There is no metadata driver for the type '".$type."'."); |
|
| 68 | 68 | |
| 69 | 69 | $class = $mappingDriver[$type]; |
| 70 | 70 | $driver = ($type === 'annotation') |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | public function testExportDirectoryAndFilesAreCreated() |
| 89 | 89 | { |
| 90 | - $this->deleteDirectory(__DIR__ . '/export/'.$this->getType()); |
|
| 90 | + $this->deleteDirectory(__DIR__.'/export/'.$this->getType()); |
|
| 91 | 91 | |
| 92 | 92 | $type = $this->getType(); |
| 93 | - $metadataDriver = $this->createMetadataDriver($type, __DIR__ . '/' . $type); |
|
| 93 | + $metadataDriver = $this->createMetadataDriver($type, __DIR__.'/'.$type); |
|
| 94 | 94 | $em = $this->createEntityManager($metadataDriver); |
| 95 | 95 | $cmf = $this->createClassMetadataFactory($em, $type); |
| 96 | 96 | $metadata = $cmf->getAllMetadata(); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | $type = $this->getType(); |
| 104 | 104 | $cme = new ClassMetadataExporter(); |
| 105 | - $exporter = $cme->getExporter($type, __DIR__ . '/export/' . $type); |
|
| 105 | + $exporter = $cme->getExporter($type, __DIR__.'/export/'.$type); |
|
| 106 | 106 | |
| 107 | 107 | if ($type === 'annotation') { |
| 108 | 108 | $exporter->setEntityGenerator(new EntityGenerator()); |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | $exporter->export(); |
| 115 | 115 | |
| 116 | 116 | if ($type == 'annotation') { |
| 117 | - self::assertTrue(file_exists(__DIR__ . '/export/' . $type . '/'.str_replace('\\', '/', ExportedUser::class).$this->extension)); |
|
| 117 | + self::assertTrue(file_exists(__DIR__.'/export/'.$type.'/'.str_replace('\\', '/', ExportedUser::class).$this->extension)); |
|
| 118 | 118 | } else { |
| 119 | - self::assertTrue(file_exists(__DIR__ . '/export/' . $type . '/Doctrine.Tests.ORM.Tools.Export.ExportedUser'.$this->extension)); |
|
| 119 | + self::assertTrue(file_exists(__DIR__.'/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser'.$this->extension)); |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | $type = $this->getType(); |
| 129 | 129 | |
| 130 | - $metadataDriver = $this->createMetadataDriver($type, __DIR__ . '/export/' . $type); |
|
| 130 | + $metadataDriver = $this->createMetadataDriver($type, __DIR__.'/export/'.$type); |
|
| 131 | 131 | $em = $this->createEntityManager($metadataDriver); |
| 132 | 132 | $cmf = $this->createClassMetadataFactory($em, $type); |
| 133 | 133 | $metadata = $cmf->getAllMetadata(); |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | $type = $this->getType(); |
| 381 | 381 | |
| 382 | 382 | if ($type === 'xml') { |
| 383 | - $xml = simplexml_load_file(__DIR__ . '/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.xml'); |
|
| 383 | + $xml = simplexml_load_file(__DIR__.'/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.xml'); |
|
| 384 | 384 | |
| 385 | 385 | $xml->registerXPathNamespace("d", "http://doctrine-project.org/schemas/orm/doctrine-mapping"); |
| 386 | 386 | $nodes = $xml->xpath("/d:doctrine-mapping/d:entity/d:one-to-many[@field='interests']/d:cascade/d:*"); |
@@ -404,10 +404,10 @@ discard block |
||
| 404 | 404 | if (is_file($path)) { |
| 405 | 405 | return unlink($path); |
| 406 | 406 | } else if (is_dir($path)) { |
| 407 | - $files = glob(rtrim($path,'/').'/*'); |
|
| 407 | + $files = glob(rtrim($path, '/').'/*'); |
|
| 408 | 408 | |
| 409 | 409 | if (is_array($files)) { |
| 410 | - foreach ($files as $file){ |
|
| 410 | + foreach ($files as $file) { |
|
| 411 | 411 | $this->deleteDirectory($file); |
| 412 | 412 | } |
| 413 | 413 | } |
@@ -654,6 +654,9 @@ discard block |
||
| 654 | 654 | return $this->items; |
| 655 | 655 | } |
| 656 | 656 | |
| 657 | + /** |
|
| 658 | + * @param string $value |
|
| 659 | + */ |
|
| 657 | 660 | public function setTransient($value) { |
| 658 | 661 | if ($value != $this->transient) { |
| 659 | 662 | $this->onPropertyChanged('transient', $this->transient, $value); |
@@ -665,6 +668,9 @@ discard block |
||
| 665 | 668 | return $this->data; |
| 666 | 669 | } |
| 667 | 670 | |
| 671 | + /** |
|
| 672 | + * @param string $data |
|
| 673 | + */ |
|
| 668 | 674 | public function setData($data) { |
| 669 | 675 | if ($data != $this->data) { |
| 670 | 676 | $this->onPropertyChanged('data', $this->data, $data); |
@@ -677,6 +683,9 @@ discard block |
||
| 677 | 683 | $this->listeners[] = $listener; |
| 678 | 684 | } |
| 679 | 685 | |
| 686 | + /** |
|
| 687 | + * @param string $propName |
|
| 688 | + */ |
|
| 680 | 689 | protected function onPropertyChanged($propName, $oldValue, $newValue) { |
| 681 | 690 | if ($this->listeners) { |
| 682 | 691 | foreach ($this->listeners as $listener) { |
@@ -707,6 +716,9 @@ discard block |
||
| 707 | 716 | return $this->owner; |
| 708 | 717 | } |
| 709 | 718 | |
| 719 | + /** |
|
| 720 | + * @param NotifyChangedEntity|null $owner |
|
| 721 | + */ |
|
| 710 | 722 | public function setOwner($owner) { |
| 711 | 723 | $this->owner = $owner; |
| 712 | 724 | } |
@@ -7,10 +7,8 @@ discard block |
||
| 7 | 7 | use Doctrine\Common\Collections\ArrayCollection; |
| 8 | 8 | use Doctrine\Common\EventManager; |
| 9 | 9 | use Doctrine\Common\NotifyPropertyChanged; |
| 10 | -use Doctrine\Common\Persistence\Event\LifecycleEventArgs; |
|
| 11 | 10 | use Doctrine\Common\PropertyChangedListener; |
| 12 | 11 | use Doctrine\ORM\Annotation as ORM; |
| 13 | -use Doctrine\ORM\Events; |
|
| 14 | 12 | use Doctrine\ORM\Mapping\ClassMetadata; |
| 15 | 13 | use Doctrine\ORM\Mapping\ClassMetadataBuildingContext; |
| 16 | 14 | use Doctrine\ORM\Mapping\ClassMetadataFactory; |
@@ -24,7 +22,6 @@ discard block |
||
| 24 | 22 | use Doctrine\Tests\Mocks\EntityPersisterMock; |
| 25 | 23 | use Doctrine\Tests\Mocks\UnitOfWorkMock; |
| 26 | 24 | use Doctrine\Tests\Models\CMS\CmsPhonenumber; |
| 27 | -use Doctrine\Tests\Models\CMS\CmsUser; |
|
| 28 | 25 | use Doctrine\Tests\Models\Forum\ForumAvatar; |
| 29 | 26 | use Doctrine\Tests\Models\Forum\ForumUser; |
| 30 | 27 | use Doctrine\Tests\Models\GeoNames\City; |
@@ -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 | |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | 'empty string, single field' => [$emptyString, ''], |
| 451 | 451 | 'non-empty string, single field' => [$nonEmptyString, $nonEmptyString->id], |
| 452 | 452 | 'empty strings, two fields' => [$emptyStrings, ' '], |
| 453 | - 'non-empty strings, two fields' => [$nonEmptyStrings, $nonEmptyStrings->id1 . ' ' . $nonEmptyStrings->id2], |
|
| 453 | + 'non-empty strings, two fields' => [$nonEmptyStrings, $nonEmptyStrings->id1.' '.$nonEmptyStrings->id2], |
|
| 454 | 454 | 'boolean true' => [$booleanTrue, '1'], |
| 455 | 455 | 'boolean false' => [$booleanFalse, ''], |
| 456 | 456 | ]; |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | |
| 482 | 482 | public function entitiesWithInvalidIdentifiersProvider() |
| 483 | 483 | { |
| 484 | - $firstNullString = new EntityWithCompositeStringIdentifier(); |
|
| 484 | + $firstNullString = new EntityWithCompositeStringIdentifier(); |
|
| 485 | 485 | |
| 486 | 486 | $firstNullString->id2 = uniqid('id2', true); |
| 487 | 487 | |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | protected $secondLevelCacheDriverImpl = null; |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | - * @param array $paths |
|
| 61 | + * @param string[] $paths |
|
| 62 | 62 | * |
| 63 | 63 | * @return \Doctrine\ORM\Mapping\Driver\AnnotationDriver |
| 64 | 64 | */ |
@@ -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; |
| 6 | 6 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | $reader = new Annotations\CachedReader(new Annotations\AnnotationReader(), new ArrayCache()); |
| 68 | 68 | |
| 69 | - Annotations\AnnotationRegistry::registerFile(__DIR__ . "/../../../lib/Doctrine/ORM/Annotation/DoctrineAnnotations.php"); |
|
| 69 | + Annotations\AnnotationRegistry::registerFile(__DIR__."/../../../lib/Doctrine/ORM/Annotation/DoctrineAnnotations.php"); |
|
| 70 | 70 | |
| 71 | 71 | return new AnnotationDriver($reader, (array) $paths); |
| 72 | 72 | } |
@@ -97,11 +97,11 @@ discard block |
||
| 97 | 97 | $config->setMetadataCacheImpl($metadataCache); |
| 98 | 98 | $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver([])); |
| 99 | 99 | $config->setQueryCacheImpl(self::getSharedQueryCacheImpl()); |
| 100 | - $config->setProxyDir(__DIR__ . '/Proxies'); |
|
| 100 | + $config->setProxyDir(__DIR__.'/Proxies'); |
|
| 101 | 101 | $config->setProxyNamespace('Doctrine\Tests\Proxies'); |
| 102 | 102 | $config->setMetadataDriverImpl( |
| 103 | 103 | $config->newDefaultAnnotationDriver([ |
| 104 | - realpath(__DIR__ . '/Models/Cache') |
|
| 104 | + realpath(__DIR__.'/Models/Cache') |
|
| 105 | 105 | ]) |
| 106 | 106 | ); |
| 107 | 107 | |
@@ -2,28 +2,28 @@ |
||
| 2 | 2 | /* |
| 3 | 3 | * This file bootstraps the test environment. |
| 4 | 4 | */ |
| 5 | -declare(strict_types=1); |
|
| 5 | +declare(strict_types = 1); |
|
| 6 | 6 | |
| 7 | 7 | namespace Doctrine\Tests; |
| 8 | 8 | |
| 9 | 9 | error_reporting(E_ALL | E_STRICT); |
| 10 | 10 | date_default_timezone_set('UTC'); |
| 11 | 11 | |
| 12 | -if (file_exists(__DIR__ . '/../../../vendor/autoload.php')) { |
|
| 12 | +if (file_exists(__DIR__.'/../../../vendor/autoload.php')) { |
|
| 13 | 13 | // dependencies were installed via composer - this is the main project |
| 14 | - require __DIR__ . '/../../../vendor/autoload.php'; |
|
| 15 | -} elseif (file_exists(__DIR__ . '/../../../../../autoload.php')) { |
|
| 14 | + require __DIR__.'/../../../vendor/autoload.php'; |
|
| 15 | +} elseif (file_exists(__DIR__.'/../../../../../autoload.php')) { |
|
| 16 | 16 | // installed as a dependency in `vendor` |
| 17 | - require __DIR__ . '/../../../../../autoload.php'; |
|
| 17 | + require __DIR__.'/../../../../../autoload.php'; |
|
| 18 | 18 | } else { |
| 19 | 19 | throw new \Exception('Can\'t find autoload.php. Did you install dependencies via composer?'); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -if ( ! file_exists(__DIR__ . '/Proxies') && ! mkdir(__DIR__ . '/Proxies')) { |
|
| 23 | - throw new \Exception("Could not create " . __DIR__."/Proxies Folder."); |
|
| 22 | +if ( ! file_exists(__DIR__.'/Proxies') && ! mkdir(__DIR__.'/Proxies')) { |
|
| 23 | + throw new \Exception("Could not create ".__DIR__."/Proxies Folder."); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | -if ( ! file_exists(__DIR__ . '/ORM/Proxy/generated') && ! mkdir(__DIR__ . '/ORM/Proxy/generated')) { |
|
| 27 | - throw new \Exception('Could not create ' . __DIR__ . '/ORM/Proxy/generated Folder.'); |
|
| 26 | +if ( ! file_exists(__DIR__.'/ORM/Proxy/generated') && ! mkdir(__DIR__.'/ORM/Proxy/generated')) { |
|
| 27 | + throw new \Exception('Could not create '.__DIR__.'/ORM/Proxy/generated Folder.'); |
|
| 28 | 28 | } |
| 29 | 29 | |