@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | $tokenStr = substr($dql, $token['position'], $length); |
493 | 493 | |
494 | 494 | // Building informative message |
495 | - $message = 'line 0, col ' . $tokenPos . " near '" . $tokenStr . "': Error: " . $message; |
|
495 | + $message = 'line 0, col '.$tokenPos." near '".$tokenStr."': Error: ".$message; |
|
496 | 496 | |
497 | 497 | throw QueryException::semanticalError($message, QueryException::dqlError($this->query->getDQL())); |
498 | 498 | } |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | // If the namespace is not given then assumes the first FROM entity namespace |
640 | 640 | if (strpos($className, '\\') === false && ! class_exists($className) && strpos($fromClassName, '\\') !== false) { |
641 | 641 | $namespace = substr($fromClassName, 0, strrpos($fromClassName, '\\')); |
642 | - $fqcn = $namespace . '\\' . $className; |
|
642 | + $fqcn = $namespace.'\\'.$className; |
|
643 | 643 | |
644 | 644 | if (class_exists($fqcn)) { |
645 | 645 | $expression->className = $fqcn; |
@@ -691,13 +691,13 @@ discard block |
||
691 | 691 | } |
692 | 692 | |
693 | 693 | $this->semanticalError( |
694 | - "There is no mapped field named '$field' on class " . $class->name . ".", $deferredItem['token'] |
|
694 | + "There is no mapped field named '$field' on class ".$class->name.".", $deferredItem['token'] |
|
695 | 695 | ); |
696 | 696 | } |
697 | 697 | |
698 | 698 | if (array_intersect($class->identifier, $expr->partialFieldSet) != $class->identifier) { |
699 | 699 | $this->semanticalError( |
700 | - "The partial field selection of class " . $class->name . " must contain the identifier.", |
|
700 | + "The partial field selection of class ".$class->name." must contain the identifier.", |
|
701 | 701 | $deferredItem['token'] |
702 | 702 | ); |
703 | 703 | } |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | // Check if field or association exists |
769 | 769 | if ( ! isset($class->associationMappings[$field]) && ! isset($class->fieldMappings[$field])) { |
770 | 770 | $this->semanticalError( |
771 | - 'Class ' . $class->name . ' has no field or association named ' . $field, |
|
771 | + 'Class '.$class->name.' has no field or association named '.$field, |
|
772 | 772 | $deferredItem['token'] |
773 | 773 | ); |
774 | 774 | } |
@@ -808,8 +808,8 @@ discard block |
||
808 | 808 | // Build the error message |
809 | 809 | $semanticalError = 'Invalid PathExpression. '; |
810 | 810 | $semanticalError .= (count($expectedStringTypes) == 1) |
811 | - ? 'Must be a ' . $expectedStringTypes[0] . '.' |
|
812 | - : implode(' or ', $expectedStringTypes) . ' expected.'; |
|
811 | + ? 'Must be a '.$expectedStringTypes[0].'.' |
|
812 | + : implode(' or ', $expectedStringTypes).' expected.'; |
|
813 | 813 | |
814 | 814 | $this->semanticalError($semanticalError, $deferredItem['token']); |
815 | 815 | } |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | |
979 | 979 | list($namespaceAlias, $simpleClassName) = explode(':', $this->lexer->token['value']); |
980 | 980 | |
981 | - $schemaName = $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName; |
|
981 | + $schemaName = $this->em->getConfiguration()->getEntityNamespace($namespaceAlias).'\\'.$simpleClassName; |
|
982 | 982 | } |
983 | 983 | |
984 | 984 | return $schemaName; |
@@ -993,7 +993,7 @@ discard block |
||
993 | 993 | */ |
994 | 994 | private function validateAbstractSchemaName($schemaName) |
995 | 995 | { |
996 | - if (! (class_exists($schemaName, true) || interface_exists($schemaName, true))) { |
|
996 | + if ( ! (class_exists($schemaName, true) || interface_exists($schemaName, true))) { |
|
997 | 997 | $this->semanticalError("Class '$schemaName' is not defined.", $this->lexer->token); |
998 | 998 | } |
999 | 999 | } |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | |
1050 | 1050 | if ( ! isset($this->queryComponents[$identVariable])) { |
1051 | 1051 | $this->semanticalError( |
1052 | - 'Identification Variable ' . $identVariable .' used in join path expression but was not defined before.' |
|
1052 | + 'Identification Variable '.$identVariable.' used in join path expression but was not defined before.' |
|
1053 | 1053 | ); |
1054 | 1054 | } |
1055 | 1055 | |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | $class = $qComp['metadata']; |
1064 | 1064 | |
1065 | 1065 | if ( ! $class->hasAssociation($field)) { |
1066 | - $this->semanticalError('Class ' . $class->name . ' has no association named ' . $field); |
|
1066 | + $this->semanticalError('Class '.$class->name.' has no association named '.$field); |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | return new AST\JoinAssociationPathExpression($identVariable, $field); |
@@ -2485,7 +2485,7 @@ discard block |
||
2485 | 2485 | // Peek beyond the matching closing parenthesis ')' |
2486 | 2486 | $peek = $this->peekBeyondClosingParenthesis(); |
2487 | 2487 | |
2488 | - if (in_array($peek['value'], ["=", "<", "<=", "<>", ">", ">=", "!="]) || |
|
2488 | + if (in_array($peek['value'], ["=", "<", "<=", "<>", ">", ">=", "!="]) || |
|
2489 | 2489 | in_array($peek['type'], [Lexer::T_NOT, Lexer::T_BETWEEN, Lexer::T_LIKE, Lexer::T_IN, Lexer::T_IS, Lexer::T_EXISTS]) || |
2490 | 2490 | $this->isMathOperator($peek)) { |
2491 | 2491 | $condPrimary->simpleConditionalExpression = $this->SimpleConditionalExpression(); |
@@ -2590,7 +2590,7 @@ discard block |
||
2590 | 2590 | return $this->NullComparisonExpression(); |
2591 | 2591 | } |
2592 | 2592 | |
2593 | - if ($token['type'] === Lexer::T_IS && $lookahead['type'] === Lexer::T_EMPTY) { |
|
2593 | + if ($token['type'] === Lexer::T_IS && $lookahead['type'] === Lexer::T_EMPTY) { |
|
2594 | 2594 | return $this->EmptyCollectionComparisonExpression(); |
2595 | 2595 | } |
2596 | 2596 |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * declarations (from ... x join ... y join ... z ...) appear in the query |
414 | 414 | * as the hydration process relies on that order for proper operation. |
415 | 415 | * |
416 | - * @param AST\SelectStatement|AST\DeleteStatement|AST\UpdateStatement $AST |
|
416 | + * @param AST\SelectStatement $AST |
|
417 | 417 | * |
418 | 418 | * @return void |
419 | 419 | */ |
@@ -1617,7 +1617,7 @@ discard block |
||
1617 | 1617 | * accessible is "FROM", prohibiting an easy implementation without larger |
1618 | 1618 | * changes.} |
1619 | 1619 | * |
1620 | - * @return \Doctrine\ORM\Query\AST\SubselectIdentificationVariableDeclaration | |
|
1620 | + * @return AST\IdentificationVariableDeclaration | |
|
1621 | 1621 | * \Doctrine\ORM\Query\AST\IdentificationVariableDeclaration |
1622 | 1622 | */ |
1623 | 1623 | public function SubselectIdentificationVariableDeclaration() |
@@ -1755,7 +1755,7 @@ discard block |
||
1755 | 1755 | /** |
1756 | 1756 | * JoinAssociationDeclaration ::= JoinAssociationPathExpression ["AS"] AliasIdentificationVariable [IndexBy] |
1757 | 1757 | * |
1758 | - * @return \Doctrine\ORM\Query\AST\JoinAssociationPathExpression |
|
1758 | + * @return AST\JoinAssociationDeclaration |
|
1759 | 1759 | */ |
1760 | 1760 | public function JoinAssociationDeclaration() |
1761 | 1761 | { |
@@ -92,7 +92,7 @@ |
||
92 | 92 | $this->_tableName, $this->_sequenceName, $this->_allocationSize |
93 | 93 | ); |
94 | 94 | |
95 | - if ($conn->executeUpdate($updateSql, [1 => $currentLevel, 2 => $currentLevel+1]) !== 1) { |
|
95 | + if ($conn->executeUpdate($updateSql, [1 => $currentLevel, 2 => $currentLevel + 1]) !== 1) { |
|
96 | 96 | // no affected rows, concurrency issue, throw exception |
97 | 97 | } |
98 | 98 | } else { |
@@ -39,7 +39,7 @@ |
||
39 | 39 | /** |
40 | 40 | * @var array |
41 | 41 | */ |
42 | - private $types = []; |
|
42 | + private $types = []; |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Converts a comparison expression into the target query language output. |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | protected function onNotFoundMetadata($className) |
107 | 107 | { |
108 | - if (! $this->evm->hasListeners(Events::onClassMetadataNotFound)) { |
|
108 | + if ( ! $this->evm->hasListeners(Events::onClassMetadataNotFound)) { |
|
109 | 109 | return; |
110 | 110 | } |
111 | 111 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $this->completeIdGeneratorMapping($class); |
163 | 163 | } |
164 | 164 | |
165 | - if (!$class->isMappedSuperclass) { |
|
165 | + if ( ! $class->isMappedSuperclass) { |
|
166 | 166 | foreach ($class->embeddedClasses as $property => $embeddableClass) { |
167 | 167 | |
168 | 168 | if (isset($embeddableClass['inherited'])) { |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | $identifier = $embeddableMetadata->getIdentifier(); |
189 | 189 | |
190 | - if (! empty($identifier)) { |
|
190 | + if ( ! empty($identifier)) { |
|
191 | 191 | $this->inheritIdGeneratorMapping($class, $embeddableMetadata); |
192 | 192 | } |
193 | 193 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | */ |
258 | 258 | protected function validateRuntimeMetadata($class, $parent) |
259 | 259 | { |
260 | - if ( ! $class->reflClass ) { |
|
260 | + if ( ! $class->reflClass) { |
|
261 | 261 | // only validate if there is a reflection class instance |
262 | 262 | return; |
263 | 263 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $class->validateLifecycleCallbacks($this->getReflectionService()); |
268 | 268 | |
269 | 269 | // verify inheritance |
270 | - if ( ! $class->isMappedSuperclass && !$class->isInheritanceTypeNone()) { |
|
270 | + if ( ! $class->isMappedSuperclass && ! $class->isInheritanceTypeNone()) { |
|
271 | 271 | if ( ! $parent) { |
272 | 272 | if (count($class->discriminatorMap) == 0) { |
273 | 273 | throw MappingException::missingDiscriminatorMap($class->name); |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | { |
429 | 429 | foreach ($parentClass->associationMappings as $field => $mapping) { |
430 | 430 | if ($parentClass->isMappedSuperclass) { |
431 | - if ($mapping['type'] & ClassMetadata::TO_MANY && !$mapping['isOwningSide']) { |
|
431 | + if ($mapping['type'] & ClassMetadata::TO_MANY && ! $mapping['isOwningSide']) { |
|
432 | 432 | throw MappingException::illegalToManyAssociationOnMappedSuperclass($parentClass->name, $field); |
433 | 433 | } |
434 | 434 | $mapping['sourceEntity'] = $subClass->name; |
@@ -477,11 +477,11 @@ discard block |
||
477 | 477 | |
478 | 478 | $parentClass->mapEmbedded( |
479 | 479 | [ |
480 | - 'fieldName' => $prefix . '.' . $property, |
|
480 | + 'fieldName' => $prefix.'.'.$property, |
|
481 | 481 | 'class' => $embeddableMetadata->name, |
482 | 482 | 'columnPrefix' => $embeddableClass['columnPrefix'], |
483 | 483 | 'declaredField' => $embeddableClass['declaredField'] |
484 | - ? $prefix . '.' . $embeddableClass['declaredField'] |
|
484 | + ? $prefix.'.'.$embeddableClass['declaredField'] |
|
485 | 485 | : $prefix, |
486 | 486 | 'originalField' => $embeddableClass['originalField'] ?: $property, |
487 | 487 | ] |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | */ |
500 | 500 | private function addInheritedIndexes(ClassMetadata $subClass, ClassMetadata $parentClass) |
501 | 501 | { |
502 | - if (! $parentClass->isMappedSuperclass) { |
|
502 | + if ( ! $parentClass->isMappedSuperclass) { |
|
503 | 503 | return; |
504 | 504 | } |
505 | 505 | |
@@ -704,14 +704,14 @@ discard block |
||
704 | 704 | case ClassMetadata::GENERATOR_TYPE_CUSTOM: |
705 | 705 | $definition = $class->customGeneratorDefinition; |
706 | 706 | if ( ! class_exists($definition['class'])) { |
707 | - throw new ORMException("Can't instantiate custom generator : " . |
|
707 | + throw new ORMException("Can't instantiate custom generator : ". |
|
708 | 708 | $definition['class']); |
709 | 709 | } |
710 | 710 | $class->setIdGenerator(new $definition['class']); |
711 | 711 | break; |
712 | 712 | |
713 | 713 | default: |
714 | - throw new ORMException("Unknown generator type: " . $class->generatorType); |
|
714 | + throw new ORMException("Unknown generator type: ".$class->generatorType); |
|
715 | 715 | } |
716 | 716 | } |
717 | 717 | |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | */ |
762 | 762 | protected function getFqcnFromAlias($namespaceAlias, $simpleClassName) |
763 | 763 | { |
764 | - return $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName; |
|
764 | + return $this->em->getConfiguration()->getEntityNamespace($namespaceAlias).'\\'.$simpleClassName; |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | /** |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | */ |
786 | 786 | private function getTargetPlatform() |
787 | 787 | { |
788 | - if (!$this->targetPlatform) { |
|
788 | + if ( ! $this->targetPlatform) { |
|
789 | 789 | $this->targetPlatform = $this->em->getConnection()->getDatabasePlatform(); |
790 | 790 | } |
791 | 791 |
@@ -20,10 +20,8 @@ |
||
20 | 20 | namespace Doctrine\ORM\Persisters\Entity; |
21 | 21 | |
22 | 22 | use Doctrine\ORM\Mapping\ClassMetadata; |
23 | - |
|
24 | 23 | use Doctrine\DBAL\LockMode; |
25 | 24 | use Doctrine\DBAL\Types\Type; |
26 | - |
|
27 | 25 | use Doctrine\Common\Collections\Criteria; |
28 | 26 | use Doctrine\ORM\Utility\PersisterHelper; |
29 | 27 |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | foreach ($data as $columnName => $value) { |
210 | - if (!is_array($id) || !isset($id[$columnName])) { |
|
210 | + if ( ! is_array($id) || ! isset($id[$columnName])) { |
|
211 | 211 | $stmt->bindValue($paramIndex++, $value, $this->columnTypes[$columnName]); |
212 | 212 | } |
213 | 213 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | // If the current class in the root entity, add the filters |
323 | 323 | if ($filterSql = $this->generateFilterConditionSQL($this->em->getClassMetadata($this->class->rootEntityName), $this->getSQLTableAlias($this->class->rootEntityName))) { |
324 | 324 | $conditionSql .= $conditionSql |
325 | - ? ' AND ' . $filterSql |
|
325 | + ? ' AND '.$filterSql |
|
326 | 326 | : $filterSql; |
327 | 327 | } |
328 | 328 | |
@@ -341,29 +341,29 @@ discard block |
||
341 | 341 | switch ($lockMode) { |
342 | 342 | case LockMode::PESSIMISTIC_READ: |
343 | 343 | |
344 | - $lockSql = ' ' . $this->platform->getReadLockSQL(); |
|
344 | + $lockSql = ' '.$this->platform->getReadLockSQL(); |
|
345 | 345 | |
346 | 346 | break; |
347 | 347 | |
348 | 348 | case LockMode::PESSIMISTIC_WRITE: |
349 | 349 | |
350 | - $lockSql = ' ' . $this->platform->getWriteLockSQL(); |
|
350 | + $lockSql = ' '.$this->platform->getWriteLockSQL(); |
|
351 | 351 | |
352 | 352 | break; |
353 | 353 | } |
354 | 354 | |
355 | 355 | $tableName = $this->quoteStrategy->getTableName($this->class, $this->platform); |
356 | - $from = ' FROM ' . $tableName . ' ' . $baseTableAlias; |
|
357 | - $where = $conditionSql != '' ? ' WHERE ' . $conditionSql : ''; |
|
356 | + $from = ' FROM '.$tableName.' '.$baseTableAlias; |
|
357 | + $where = $conditionSql != '' ? ' WHERE '.$conditionSql : ''; |
|
358 | 358 | $lock = $this->platform->appendLockHint($from, $lockMode); |
359 | 359 | $columnList = $this->getSelectColumnsSQL(); |
360 | - $query = 'SELECT ' . $columnList |
|
360 | + $query = 'SELECT '.$columnList |
|
361 | 361 | . $lock |
362 | 362 | . $joinSql |
363 | 363 | . $where |
364 | 364 | . $orderBySql; |
365 | 365 | |
366 | - return $this->platform->modifyLimitQuery($query, $limit, $offset) . $lockSql; |
|
366 | + return $this->platform->modifyLimitQuery($query, $limit, $offset).$lockSql; |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
@@ -383,14 +383,14 @@ discard block |
||
383 | 383 | |
384 | 384 | if ('' !== $filterSql) { |
385 | 385 | $conditionSql = $conditionSql |
386 | - ? $conditionSql . ' AND ' . $filterSql |
|
386 | + ? $conditionSql.' AND '.$filterSql |
|
387 | 387 | : $filterSql; |
388 | 388 | } |
389 | 389 | |
390 | 390 | $sql = 'SELECT COUNT(*) ' |
391 | - . 'FROM ' . $tableName . ' ' . $baseTableAlias |
|
391 | + . 'FROM '.$tableName.' '.$baseTableAlias |
|
392 | 392 | . $joinSql |
393 | - . (empty($conditionSql) ? '' : ' WHERE ' . $conditionSql); |
|
393 | + . (empty($conditionSql) ? '' : ' WHERE '.$conditionSql); |
|
394 | 394 | |
395 | 395 | return $sql; |
396 | 396 | } |
@@ -409,16 +409,16 @@ discard block |
||
409 | 409 | $conditions = []; |
410 | 410 | $tableAlias = $this->getSQLTableAlias($parentClassName); |
411 | 411 | $parentClass = $this->em->getClassMetadata($parentClassName); |
412 | - $joinSql .= ' INNER JOIN ' . $this->quoteStrategy->getTableName($parentClass, $this->platform) . ' ' . $tableAlias . ' ON '; |
|
412 | + $joinSql .= ' INNER JOIN '.$this->quoteStrategy->getTableName($parentClass, $this->platform).' '.$tableAlias.' ON '; |
|
413 | 413 | |
414 | 414 | foreach ($identifierColumns as $idColumn) { |
415 | - $conditions[] = $baseTableAlias . '.' . $idColumn . ' = ' . $tableAlias . '.' . $idColumn; |
|
415 | + $conditions[] = $baseTableAlias.'.'.$idColumn.' = '.$tableAlias.'.'.$idColumn; |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | $joinSql .= implode(' AND ', $conditions); |
419 | 419 | } |
420 | 420 | |
421 | - return parent::getLockTablesSql($lockMode) . $joinSql; |
|
421 | + return parent::getLockTablesSql($lockMode).$joinSql; |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | /** |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | ? $baseTableAlias |
480 | 480 | : $this->getSQLTableAlias($this->class->rootEntityName); |
481 | 481 | |
482 | - $columnList[] = $tableAlias . '.' . $discrColumn; |
|
482 | + $columnList[] = $tableAlias.'.'.$discrColumn; |
|
483 | 483 | |
484 | 484 | // sub tables |
485 | 485 | foreach ($this->class->subClasses as $subClassName) { |
@@ -586,11 +586,11 @@ discard block |
||
586 | 586 | $conditions = []; |
587 | 587 | $parentClass = $this->em->getClassMetadata($parentClassName); |
588 | 588 | $tableAlias = $this->getSQLTableAlias($parentClassName); |
589 | - $joinSql .= ' INNER JOIN ' . $this->quoteStrategy->getTableName($parentClass, $this->platform) . ' ' . $tableAlias . ' ON '; |
|
589 | + $joinSql .= ' INNER JOIN '.$this->quoteStrategy->getTableName($parentClass, $this->platform).' '.$tableAlias.' ON '; |
|
590 | 590 | |
591 | 591 | |
592 | 592 | foreach ($identifierColumn as $idColumn) { |
593 | - $conditions[] = $baseTableAlias . '.' . $idColumn . ' = ' . $tableAlias . '.' . $idColumn; |
|
593 | + $conditions[] = $baseTableAlias.'.'.$idColumn.' = '.$tableAlias.'.'.$idColumn; |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | $joinSql .= implode(' AND ', $conditions); |
@@ -601,10 +601,10 @@ discard block |
||
601 | 601 | $conditions = []; |
602 | 602 | $subClass = $this->em->getClassMetadata($subClassName); |
603 | 603 | $tableAlias = $this->getSQLTableAlias($subClassName); |
604 | - $joinSql .= ' LEFT JOIN ' . $this->quoteStrategy->getTableName($subClass, $this->platform) . ' ' . $tableAlias . ' ON '; |
|
604 | + $joinSql .= ' LEFT JOIN '.$this->quoteStrategy->getTableName($subClass, $this->platform).' '.$tableAlias.' ON '; |
|
605 | 605 | |
606 | 606 | foreach ($identifierColumn as $idColumn) { |
607 | - $conditions[] = $baseTableAlias . '.' . $idColumn . ' = ' . $tableAlias . '.' . $idColumn; |
|
607 | + $conditions[] = $baseTableAlias.'.'.$idColumn.' = '.$tableAlias.'.'.$idColumn; |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | $joinSql .= implode(' AND ', $conditions); |
@@ -31,6 +31,7 @@ |
||
31 | 31 | |
32 | 32 | /** |
33 | 33 | * {@inheritdoc} |
34 | + * @param \Doctrine\Tests\ORM\NotifyChangedEntity $entity |
|
34 | 35 | */ |
35 | 36 | public function & getEntityChangeSet($entity) |
36 | 37 | { |
@@ -146,6 +146,12 @@ discard block |
||
146 | 146 | return [$user1, $user2, $user3]; |
147 | 147 | } |
148 | 148 | |
149 | + /** |
|
150 | + * @param string $name |
|
151 | + * @param string $username |
|
152 | + * @param string $status |
|
153 | + * @param CmsAddress $address |
|
154 | + */ |
|
149 | 155 | public function buildUser($name, $username, $status, $address) |
150 | 156 | { |
151 | 157 | $user = new CmsUser(); |
@@ -160,6 +166,12 @@ discard block |
||
160 | 166 | return $user; |
161 | 167 | } |
162 | 168 | |
169 | + /** |
|
170 | + * @param string $country |
|
171 | + * @param string $city |
|
172 | + * @param string $street |
|
173 | + * @param string $zip |
|
174 | + */ |
|
163 | 175 | public function buildAddress($country, $city, $street, $zip) |
164 | 176 | { |
165 | 177 | $address = new CmsAddress(); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function testExceptionIsThrownWhenCallingFindByWithoutParameter() { |
310 | 310 | $this->_em->getRepository(CmsUser::class) |
311 | - ->findByStatus(); |
|
311 | + ->findByStatus(); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | /** |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | */ |
317 | 317 | public function testExceptionIsThrownWhenUsingInvalidFieldName() { |
318 | 318 | $this->_em->getRepository(CmsUser::class) |
319 | - ->findByThisFieldDoesNotExist('testvalue'); |
|
319 | + ->findByThisFieldDoesNotExist('testvalue'); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /** |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | $this->expectException(TransactionRequiredException::class); |
329 | 329 | |
330 | 330 | $this->_em->getRepository(CmsUser::class) |
331 | - ->find(1, LockMode::PESSIMISTIC_READ); |
|
331 | + ->find(1, LockMode::PESSIMISTIC_READ); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | $this->expectException(TransactionRequiredException::class); |
341 | 341 | |
342 | 342 | $this->_em->getRepository(CmsUser::class) |
343 | - ->find(1, LockMode::PESSIMISTIC_WRITE); |
|
343 | + ->find(1, LockMode::PESSIMISTIC_WRITE); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $this->expectException(OptimisticLockException::class); |
353 | 353 | |
354 | 354 | $this->_em->getRepository(CmsUser::class) |
355 | - ->find(1, LockMode::OPTIMISTIC); |
|
355 | + ->find(1, LockMode::OPTIMISTIC); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
@@ -433,13 +433,13 @@ discard block |
||
433 | 433 | */ |
434 | 434 | public function testFindOneByOrderBy() |
435 | 435 | { |
436 | - $this->loadFixture(); |
|
436 | + $this->loadFixture(); |
|
437 | 437 | |
438 | - $repos = $this->_em->getRepository(CmsUser::class); |
|
439 | - $userAsc = $repos->findOneBy([], ["username" => "ASC"]); |
|
440 | - $userDesc = $repos->findOneBy([], ["username" => "DESC"]); |
|
438 | + $repos = $this->_em->getRepository(CmsUser::class); |
|
439 | + $userAsc = $repos->findOneBy([], ["username" => "ASC"]); |
|
440 | + $userDesc = $repos->findOneBy([], ["username" => "DESC"]); |
|
441 | 441 | |
442 | - $this->assertNotSame($userAsc, $userDesc); |
|
442 | + $this->assertNotSame($userAsc, $userDesc); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | /** |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $repos = $this->_em->getRepository(CmsUser::class); |
181 | 181 | |
182 | 182 | $user = $repos->find($user1Id); |
183 | - $this->assertInstanceOf(CmsUser::class,$user); |
|
183 | + $this->assertInstanceOf(CmsUser::class, $user); |
|
184 | 184 | $this->assertEquals('Roman', $user->name); |
185 | 185 | $this->assertEquals('freak', $user->status); |
186 | 186 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | $users = $repos->findBy(['status' => 'dev']); |
194 | 194 | $this->assertEquals(2, count($users)); |
195 | - $this->assertInstanceOf(CmsUser::class,$users[0]); |
|
195 | + $this->assertInstanceOf(CmsUser::class, $users[0]); |
|
196 | 196 | $this->assertEquals('Guilherme', $users[0]->name); |
197 | 197 | $this->assertEquals('dev', $users[0]->status); |
198 | 198 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $addresses = $repository->findBy(['user' => [$user1->getId(), $user2->getId()]]); |
219 | 219 | |
220 | 220 | $this->assertEquals(2, count($addresses)); |
221 | - $this->assertInstanceOf(CmsAddress::class,$addresses[0]); |
|
221 | + $this->assertInstanceOf(CmsAddress::class, $addresses[0]); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | public function testFindByAssociationWithObjectAsParameter() |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $addresses = $repository->findBy(['user' => [$user1, $user2]]); |
243 | 243 | |
244 | 244 | $this->assertEquals(2, count($addresses)); |
245 | - $this->assertInstanceOf(CmsAddress::class,$addresses[0]); |
|
245 | + $this->assertInstanceOf(CmsAddress::class, $addresses[0]); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | public function testFindFieldByMagicCall() |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | |
253 | 253 | $users = $repos->findByStatus('dev'); |
254 | 254 | $this->assertEquals(2, count($users)); |
255 | - $this->assertInstanceOf(CmsUser::class,$users[0]); |
|
255 | + $this->assertInstanceOf(CmsUser::class, $users[0]); |
|
256 | 256 | $this->assertEquals('Guilherme', $users[0]->name); |
257 | 257 | $this->assertEquals('dev', $users[0]->status); |
258 | 258 | } |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | $this->assertEquals(2, count($usersAsc)); |
593 | 593 | $this->assertEquals(2, count($usersDesc)); |
594 | 594 | |
595 | - $this->assertInstanceOf(CmsUser::class,$usersAsc[0]); |
|
595 | + $this->assertInstanceOf(CmsUser::class, $usersAsc[0]); |
|
596 | 596 | $this->assertEquals('Alexander', $usersAsc[0]->name); |
597 | 597 | $this->assertEquals('dev', $usersAsc[0]->status); |
598 | 598 | |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | public function testCanRetrieveRepositoryFromClassNameWithLeadingBackslash() |
674 | 674 | { |
675 | 675 | $this->assertSame( |
676 | - $this->_em->getRepository('\\' . CmsUser::class), |
|
676 | + $this->_em->getRepository('\\'.CmsUser::class), |
|
677 | 677 | $this->_em->getRepository(CmsUser::class) |
678 | 678 | ); |
679 | 679 | } |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | $data = $repo->findBy(['user' => [1, 2, 3]]); |
712 | 712 | |
713 | 713 | $query = array_pop($this->_sqlLoggerStack->queries); |
714 | - $this->assertEquals([1,2,3], $query['params'][0]); |
|
714 | + $this->assertEquals([1, 2, 3], $query['params'][0]); |
|
715 | 715 | $this->assertEquals(Connection::PARAM_INT_ARRAY, $query['types'][0]); |
716 | 716 | } |
717 | 717 |
@@ -3,14 +3,13 @@ |
||
3 | 3 | namespace Doctrine\Tests\ORM\Functional; |
4 | 4 | |
5 | 5 | use Doctrine\Common\Collections\ArrayCollection; |
6 | - |
|
7 | 6 | use Doctrine\ORM\NonUniqueResultException; |
8 | 7 | use Doctrine\ORM\Proxy\Proxy; |
9 | 8 | use Doctrine\ORM\Query\QueryException; |
10 | 9 | use Doctrine\ORM\UnexpectedResultException; |
11 | -use Doctrine\Tests\Models\CMS\CmsUser, |
|
12 | - Doctrine\Tests\Models\CMS\CmsArticle, |
|
13 | - Doctrine\Tests\Models\CMS\CmsPhonenumber; |
|
10 | +use Doctrine\Tests\Models\CMS\CmsUser; |
|
11 | +use Doctrine\Tests\Models\CMS\CmsArticle; |
|
12 | +use Doctrine\Tests\Models\CMS\CmsPhonenumber; |
|
14 | 13 | use Doctrine\ORM\Mapping\ClassMetadata; |
15 | 14 | use Doctrine\ORM\Query; |
16 | 15 | use Doctrine\ORM\Query\Parameter; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $this->expectExceptionMessage('Too few parameters: the query defines 1 parameters but you only bound 0'); |
149 | 149 | |
150 | 150 | $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1') |
151 | - ->getSingleResult(); |
|
151 | + ->getSingleResult(); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | public function testInvalidInputParameterThrowsException() |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | $this->expectException(QueryException::class); |
157 | 157 | |
158 | 158 | $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?') |
159 | - ->setParameter(1, 'jwage') |
|
160 | - ->getSingleResult(); |
|
159 | + ->setParameter(1, 'jwage') |
|
160 | + ->getSingleResult(); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | public function testSetParameters() |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | $parameters->add(new Parameter(2, 'active')); |
168 | 168 | |
169 | 169 | $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1 AND u.status = ?2') |
170 | - ->setParameters($parameters) |
|
171 | - ->getResult(); |
|
170 | + ->setParameters($parameters) |
|
171 | + ->getResult(); |
|
172 | 172 | |
173 | 173 | $extractValue = function (Parameter $parameter) { |
174 | 174 | return $parameter->getValue(); |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | $parameters = [1 => 'jwage', 2 => 'active']; |
186 | 186 | |
187 | 187 | $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1 AND u.status = ?2') |
188 | - ->setParameters($parameters) |
|
189 | - ->getResult(); |
|
188 | + ->setParameters($parameters) |
|
189 | + ->getResult(); |
|
190 | 190 | |
191 | 191 | self::assertSame( |
192 | 192 | array_values($parameters), |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | public function testGetSingleResultThrowsExceptionOnNoResult() |
331 | 331 | { |
332 | 332 | $this->_em->createQuery("select a from Doctrine\Tests\Models\CMS\CmsArticle a") |
333 | - ->getSingleResult(); |
|
333 | + ->getSingleResult(); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | /** |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | public function testGetSingleScalarResultThrowsExceptionOnNoResult() |
340 | 340 | { |
341 | 341 | $this->_em->createQuery("select a from Doctrine\Tests\Models\CMS\CmsArticle a") |
342 | - ->getSingleScalarResult(); |
|
342 | + ->getSingleScalarResult(); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | /** |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | $this->_em->clear(); |
371 | 371 | |
372 | 372 | $this->_em->createQuery("select a from Doctrine\Tests\Models\CMS\CmsArticle a") |
373 | - ->getSingleScalarResult(); |
|
373 | + ->getSingleScalarResult(); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | public function testModifiedLimitQuery() |
@@ -387,27 +387,27 @@ discard block |
||
387 | 387 | $this->_em->clear(); |
388 | 388 | |
389 | 389 | $data = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u') |
390 | - ->setFirstResult(1) |
|
391 | - ->setMaxResults(2) |
|
392 | - ->getResult(); |
|
390 | + ->setFirstResult(1) |
|
391 | + ->setMaxResults(2) |
|
392 | + ->getResult(); |
|
393 | 393 | |
394 | 394 | $this->assertEquals(2, count($data)); |
395 | 395 | $this->assertEquals('gblanco1', $data[0]->username); |
396 | 396 | $this->assertEquals('gblanco2', $data[1]->username); |
397 | 397 | |
398 | 398 | $data = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u') |
399 | - ->setFirstResult(3) |
|
400 | - ->setMaxResults(2) |
|
401 | - ->getResult(); |
|
399 | + ->setFirstResult(3) |
|
400 | + ->setMaxResults(2) |
|
401 | + ->getResult(); |
|
402 | 402 | |
403 | 403 | $this->assertEquals(2, count($data)); |
404 | 404 | $this->assertEquals('gblanco3', $data[0]->username); |
405 | 405 | $this->assertEquals('gblanco4', $data[1]->username); |
406 | 406 | |
407 | 407 | $data = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u') |
408 | - ->setFirstResult(3) |
|
409 | - ->setMaxResults(2) |
|
410 | - ->getScalarResult(); |
|
408 | + ->setFirstResult(3) |
|
409 | + ->setMaxResults(2) |
|
410 | + ->getScalarResult(); |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | public function testSupportsQueriesWithEntityNamespaces() |
@@ -476,8 +476,8 @@ discard block |
||
476 | 476 | $this->_em->clear(); |
477 | 477 | |
478 | 478 | $articles = $this->_em->createQuery('select a from Doctrine\Tests\Models\CMS\CmsArticle a') |
479 | - ->setFetchMode(CmsArticle::class, 'user', ClassMetadata::FETCH_EAGER) |
|
480 | - ->getResult(); |
|
479 | + ->setFetchMode(CmsArticle::class, 'user', ClassMetadata::FETCH_EAGER) |
|
480 | + ->getResult(); |
|
481 | 481 | |
482 | 482 | $this->assertEquals(10, count($articles)); |
483 | 483 | foreach ($articles AS $article) { |
@@ -619,9 +619,9 @@ discard block |
||
619 | 619 | { |
620 | 620 | $qb = $this->_em->createQueryBuilder(); |
621 | 621 | $qb->select('u') |
622 | - ->from(CmsUser::class, 'u') |
|
623 | - ->innerJoin('u.articles', 'a') |
|
624 | - ->where('(u.id = 0) OR (u.id IS NULL)'); |
|
622 | + ->from(CmsUser::class, 'u') |
|
623 | + ->innerJoin('u.articles', 'a') |
|
624 | + ->where('(u.id = 0) OR (u.id IS NULL)'); |
|
625 | 625 | |
626 | 626 | $query = $qb->getQuery(); |
627 | 627 | $users = $query->execute(); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $this->_em->flush(); |
95 | 95 | $this->_em->clear(); |
96 | 96 | |
97 | - $query = $this->_em->createQuery('select u, a from ' . CmsUser::class . ' u join u.articles a ORDER BY a.topic'); |
|
97 | + $query = $this->_em->createQuery('select u, a from '.CmsUser::class.' u join u.articles a ORDER BY a.topic'); |
|
98 | 98 | $users = $query->getResult(); |
99 | 99 | $this->assertEquals(1, count($users)); |
100 | 100 | $this->assertInstanceOf(CmsUser::class, $users[0]); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $this->_em->flush(); |
114 | 114 | $this->_em->clear(); |
115 | 115 | |
116 | - $q = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.username = ?0'); |
|
116 | + $q = $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u WHERE u.username = ?0'); |
|
117 | 117 | $q->setParameter(0, 'jwage'); |
118 | 118 | $user = $q->getSingleResult(); |
119 | 119 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $this->expectException(QueryException::class); |
126 | 126 | $this->expectExceptionMessage('Invalid parameter: token 2 is not defined in the query.'); |
127 | 127 | |
128 | - $q = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1'); |
|
128 | + $q = $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u WHERE u.name = ?1'); |
|
129 | 129 | $q->setParameter(2, 'jwage'); |
130 | 130 | $user = $q->getSingleResult(); |
131 | 131 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $this->expectException(QueryException::class); |
136 | 136 | $this->expectExceptionMessage('Too many parameters: the query defines 1 parameters and you bound 2'); |
137 | 137 | |
138 | - $q = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1'); |
|
138 | + $q = $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u WHERE u.name = ?1'); |
|
139 | 139 | $q->setParameter(1, 'jwage'); |
140 | 140 | $q->setParameter(2, 'jwage'); |
141 | 141 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $this->expectException(QueryException::class); |
148 | 148 | $this->expectExceptionMessage('Too few parameters: the query defines 1 parameters but you only bound 0'); |
149 | 149 | |
150 | - $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1') |
|
150 | + $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u WHERE u.name = ?1') |
|
151 | 151 | ->getSingleResult(); |
152 | 152 | } |
153 | 153 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | { |
156 | 156 | $this->expectException(QueryException::class); |
157 | 157 | |
158 | - $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?') |
|
158 | + $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u WHERE u.name = ?') |
|
159 | 159 | ->setParameter(1, 'jwage') |
160 | 160 | ->getSingleResult(); |
161 | 161 | } |
@@ -166,11 +166,11 @@ discard block |
||
166 | 166 | $parameters->add(new Parameter(1, 'jwage')); |
167 | 167 | $parameters->add(new Parameter(2, 'active')); |
168 | 168 | |
169 | - $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1 AND u.status = ?2') |
|
169 | + $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u WHERE u.name = ?1 AND u.status = ?2') |
|
170 | 170 | ->setParameters($parameters) |
171 | 171 | ->getResult(); |
172 | 172 | |
173 | - $extractValue = function (Parameter $parameter) { |
|
173 | + $extractValue = function(Parameter $parameter) { |
|
174 | 174 | return $parameter->getValue(); |
175 | 175 | }; |
176 | 176 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | { |
185 | 185 | $parameters = [1 => 'jwage', 2 => 'active']; |
186 | 186 | |
187 | - $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1 AND u.status = ?2') |
|
187 | + $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u WHERE u.name = ?1 AND u.status = ?2') |
|
188 | 188 | ->setParameters($parameters) |
189 | 189 | ->getResult(); |
190 | 190 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $this->_em->clear(); |
215 | 215 | $articleId = $article1->id; |
216 | 216 | |
217 | - $query = $this->_em->createQuery('select a from ' . CmsArticle::class . ' a WHERE a.topic = ?1'); |
|
217 | + $query = $this->_em->createQuery('select a from '.CmsArticle::class.' a WHERE a.topic = ?1'); |
|
218 | 218 | $articles = $query->iterate(new ArrayCollection([new Parameter(1, 'Doctrine 2')]), Query::HYDRATE_ARRAY); |
219 | 219 | |
220 | 220 | $found = []; |
@@ -255,19 +255,19 @@ discard block |
||
255 | 255 | $this->_em->flush(); |
256 | 256 | $this->_em->clear(); |
257 | 257 | |
258 | - $query = $this->_em->createQuery('select a from ' . CmsArticle::class . ' a'); |
|
258 | + $query = $this->_em->createQuery('select a from '.CmsArticle::class.' a'); |
|
259 | 259 | $articles = $query->iterate(); |
260 | 260 | |
261 | 261 | $iteratedCount = 0; |
262 | 262 | $topics = []; |
263 | 263 | |
264 | - foreach($articles AS $row) { |
|
264 | + foreach ($articles AS $row) { |
|
265 | 265 | $article = $row[0]; |
266 | 266 | $topics[] = $article->topic; |
267 | 267 | |
268 | 268 | $identityMap = $this->_em->getUnitOfWork()->getIdentityMap(); |
269 | 269 | $identityMapCount = count($identityMap[CmsArticle::class]); |
270 | - $this->assertTrue($identityMapCount>$iteratedCount); |
|
270 | + $this->assertTrue($identityMapCount > $iteratedCount); |
|
271 | 271 | |
272 | 272 | $iteratedCount++; |
273 | 273 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | |
301 | 301 | $iteratedCount = 0; |
302 | 302 | $topics = []; |
303 | - foreach($articles AS $row) { |
|
303 | + foreach ($articles AS $row) { |
|
304 | 304 | $article = $row[0]; |
305 | 305 | $topics[] = $article->topic; |
306 | 306 | |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | { |
378 | 378 | for ($i = 0; $i < 5; $i++) { |
379 | 379 | $user = new CmsUser; |
380 | - $user->name = 'Guilherme' . $i; |
|
381 | - $user->username = 'gblanco' . $i; |
|
380 | + $user->name = 'Guilherme'.$i; |
|
381 | + $user->username = 'gblanco'.$i; |
|
382 | 382 | $user->status = 'developer'; |
383 | 383 | $this->_em->persist($user); |
384 | 384 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $this->_em->flush(); |
387 | 387 | $this->_em->clear(); |
388 | 388 | |
389 | - $data = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u') |
|
389 | + $data = $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u') |
|
390 | 390 | ->setFirstResult(1) |
391 | 391 | ->setMaxResults(2) |
392 | 392 | ->getResult(); |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $this->assertEquals('gblanco1', $data[0]->username); |
396 | 396 | $this->assertEquals('gblanco2', $data[1]->username); |
397 | 397 | |
398 | - $data = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u') |
|
398 | + $data = $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u') |
|
399 | 399 | ->setFirstResult(3) |
400 | 400 | ->setMaxResults(2) |
401 | 401 | ->getResult(); |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | $this->assertEquals('gblanco3', $data[0]->username); |
405 | 405 | $this->assertEquals('gblanco4', $data[1]->username); |
406 | 406 | |
407 | - $data = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u') |
|
407 | + $data = $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u') |
|
408 | 408 | ->setFirstResult(3) |
409 | 409 | ->setMaxResults(2) |
410 | 410 | ->getScalarResult(); |
@@ -498,13 +498,13 @@ discard block |
||
498 | 498 | $this->_em->flush(); |
499 | 499 | $this->_em->clear(); |
500 | 500 | |
501 | - $query = $this->_em->createQuery("select u from " . CmsUser::class . " u where u.username = 'gblanco'"); |
|
501 | + $query = $this->_em->createQuery("select u from ".CmsUser::class." u where u.username = 'gblanco'"); |
|
502 | 502 | |
503 | 503 | $fetchedUser = $query->getOneOrNullResult(); |
504 | 504 | $this->assertInstanceOf(CmsUser::class, $fetchedUser); |
505 | 505 | $this->assertEquals('gblanco', $fetchedUser->username); |
506 | 506 | |
507 | - $query = $this->_em->createQuery("select u.username from " . CmsUser::class . " u where u.username = 'gblanco'"); |
|
507 | + $query = $this->_em->createQuery("select u.username from ".CmsUser::class." u where u.username = 'gblanco'"); |
|
508 | 508 | $fetchedUsername = $query->getOneOrNullResult(Query::HYDRATE_SINGLE_SCALAR); |
509 | 509 | $this->assertEquals('gblanco', $fetchedUsername); |
510 | 510 | } |
@@ -173,6 +173,10 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public $phones; |
175 | 175 | |
176 | + /** |
|
177 | + * @param string $email |
|
178 | + * @param string $name |
|
179 | + */ |
|
176 | 180 | public function __construct($email, $name, array $numbers = []) |
177 | 181 | { |
178 | 182 | $this->name = $name; |
@@ -208,6 +212,9 @@ discard block |
||
208 | 212 | */ |
209 | 213 | public $user; |
210 | 214 | |
215 | + /** |
|
216 | + * @param DDC1335User $user |
|
217 | + */ |
|
211 | 218 | public function __construct($user, $number) |
212 | 219 | { |
213 | 220 | $this->user = $user; |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | ] |
19 | 19 | ); |
20 | 20 | $this->loadFixture(); |
21 | - } catch(\Exception $e) { |
|
21 | + } catch (\Exception $e) { |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 | |
25 | 25 | |
26 | 26 | public function testDql() |
27 | 27 | { |
28 | - $dql = 'SELECT u FROM ' . __NAMESPACE__ . '\DDC1335User u INDEX BY u.id'; |
|
28 | + $dql = 'SELECT u FROM '.__NAMESPACE__.'\DDC1335User u INDEX BY u.id'; |
|
29 | 29 | $query = $this->_em->createQuery($dql); |
30 | 30 | $result = $query->getResult(); |
31 | 31 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $this->assertArrayHasKey(2, $result); |
35 | 35 | $this->assertArrayHasKey(3, $result); |
36 | 36 | |
37 | - $dql = 'SELECT u, p FROM '.__NAMESPACE__ . '\DDC1335User u INDEX BY u.email INNER JOIN u.phones p INDEX BY p.id'; |
|
37 | + $dql = 'SELECT u, p FROM '.__NAMESPACE__.'\DDC1335User u INDEX BY u.email INNER JOIN u.phones p INDEX BY p.id'; |
|
38 | 38 | $query = $this->_em->createQuery($dql); |
39 | 39 | $result = $query->getResult(); |
40 | 40 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $this->assertArrayHasKey(1, $result); |
77 | 77 | $this->assertArrayHasKey(2, $result); |
78 | 78 | $this->assertArrayHasKey(3, $result); |
79 | - $this->assertEquals('SELECT u FROM ' . __NAMESPACE__ . '\DDC1335User u INDEX BY u.id', $dql); |
|
79 | + $this->assertEquals('SELECT u FROM '.__NAMESPACE__.'\DDC1335User u INDEX BY u.id', $dql); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | public function testIndexByUnique() |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | $this->assertArrayHasKey('[email protected]', $result); |
92 | 92 | $this->assertArrayHasKey('[email protected]', $result); |
93 | 93 | $this->assertArrayHasKey('[email protected]', $result); |
94 | - $this->assertEquals('SELECT u FROM ' . __NAMESPACE__ . '\DDC1335User u INDEX BY u.email', $dql); |
|
94 | + $this->assertEquals('SELECT u FROM '.__NAMESPACE__.'\DDC1335User u INDEX BY u.email', $dql); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | public function testIndexWithJoin() |
98 | 98 | { |
99 | 99 | $builder = $this->_em->createQueryBuilder(); |
100 | - $builder->select('u','p') |
|
100 | + $builder->select('u', 'p') |
|
101 | 101 | ->from(DDC1335User::class, 'u', 'u.email') |
102 | 102 | ->join('u.phones', 'p', null, null, 'p.id'); |
103 | 103 | |
@@ -125,18 +125,18 @@ discard block |
||
125 | 125 | $this->assertArrayHasKey(8, $result['[email protected]']->phones->toArray()); |
126 | 126 | $this->assertArrayHasKey(9, $result['[email protected]']->phones->toArray()); |
127 | 127 | |
128 | - $this->assertEquals('SELECT u, p FROM '.__NAMESPACE__ . '\DDC1335User u INDEX BY u.email INNER JOIN u.phones p INDEX BY p.id', $dql); |
|
128 | + $this->assertEquals('SELECT u, p FROM '.__NAMESPACE__.'\DDC1335User u INDEX BY u.email INNER JOIN u.phones p INDEX BY p.id', $dql); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | private function loadFixture() |
132 | 132 | { |
133 | - $p1 = ['11 xxxx-xxxx','11 yyyy-yyyy','11 zzzz-zzzz']; |
|
134 | - $p2 = ['22 xxxx-xxxx','22 yyyy-yyyy','22 zzzz-zzzz']; |
|
135 | - $p3 = ['33 xxxx-xxxx','33 yyyy-yyyy','33 zzzz-zzzz']; |
|
133 | + $p1 = ['11 xxxx-xxxx', '11 yyyy-yyyy', '11 zzzz-zzzz']; |
|
134 | + $p2 = ['22 xxxx-xxxx', '22 yyyy-yyyy', '22 zzzz-zzzz']; |
|
135 | + $p3 = ['33 xxxx-xxxx', '33 yyyy-yyyy', '33 zzzz-zzzz']; |
|
136 | 136 | |
137 | - $u1 = new DDC1335User("[email protected]", "Foo",$p1); |
|
138 | - $u2 = new DDC1335User("[email protected]", "Bar",$p2); |
|
139 | - $u3 = new DDC1335User("[email protected]", "Foo Bar",$p3); |
|
137 | + $u1 = new DDC1335User("[email protected]", "Foo", $p1); |
|
138 | + $u2 = new DDC1335User("[email protected]", "Bar", $p2); |
|
139 | + $u3 = new DDC1335User("[email protected]", "Foo Bar", $p3); |
|
140 | 140 | |
141 | 141 | $this->_em->persist($u1); |
142 | 142 | $this->_em->persist($u2); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $this->phones = new \Doctrine\Common\Collections\ArrayCollection(); |
181 | 181 | |
182 | 182 | foreach ($numbers as $number) { |
183 | - $this->phones->add(new DDC1335Phone($this,$number)); |
|
183 | + $this->phones->add(new DDC1335Phone($this, $number)); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | public function __construct($user, $number) |
212 | 212 | { |
213 | - $this->user = $user; |
|
214 | - $this->numericalValue = $number; |
|
213 | + $this->user = $user; |
|
214 | + $this->numericalValue = $number; |
|
215 | 215 | } |
216 | 216 | } |