@@ -22,7 +22,6 @@ |
||
| 22 | 22 | namespace Doctrine\ORM\Persisters\Collection; |
| 23 | 23 | |
| 24 | 24 | use Doctrine\Common\Collections\Criteria; |
| 25 | -use Doctrine\ORM\Mapping\ColumnMetadata; |
|
| 26 | 25 | use Doctrine\ORM\Mapping\InheritanceType; |
| 27 | 26 | use Doctrine\ORM\Mapping\ToManyAssociationMetadata; |
| 28 | 27 | use Doctrine\ORM\PersistentCollection; |
@@ -145,9 +145,9 @@ discard block |
||
| 145 | 145 | return (bool) $persister->count($criteria); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - /** |
|
| 149 | - * {@inheritdoc} |
|
| 150 | - */ |
|
| 148 | + /** |
|
| 149 | + * {@inheritdoc} |
|
| 150 | + */ |
|
| 151 | 151 | public function contains(PersistentCollection $collection, $element) |
| 152 | 152 | { |
| 153 | 153 | if ( ! $this->isValidEntityState($element)) { |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | // 2) Build insert table records into temporary table |
| 267 | 267 | $dql = ' SELECT t0.' . implode(', t0.', $rootClass->getIdentifierFieldNames()) |
| 268 | - . ' FROM ' . $targetClass->getClassName() . ' t0 WHERE t0.' . $association->getMappedBy() . ' = :owner'; |
|
| 268 | + . ' FROM ' . $targetClass->getClassName() . ' t0 WHERE t0.' . $association->getMappedBy() . ' = :owner'; |
|
| 269 | 269 | $query = $this->em->createQuery($dql)->setParameter('owner', $collection->getOwner()); |
| 270 | 270 | |
| 271 | 271 | $statement = 'INSERT INTO ' . $tempTable . ' (' . $idColumnNameList . ') ' . $query->getSQL(); |
@@ -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\ORM\Persisters\Collection; |
| 6 | 6 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | // the entire collection with a new would trigger this operation. |
| 31 | 31 | $association = $collection->getMapping(); |
| 32 | 32 | |
| 33 | - if (! $association->isOrphanRemoval()) { |
|
| 33 | + if ( ! $association->isOrphanRemoval()) { |
|
| 34 | 34 | // Handling non-orphan removal should never happen, as @OneToMany |
| 35 | 35 | // can only be inverse side. For owning side one to many, it is |
| 36 | 36 | // required to have a join table, which would classify as a ManyToManyPersister. |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | $association = $collection->getMapping(); |
| 64 | 64 | |
| 65 | - if (! ($association instanceof ToManyAssociationMetadata && $association->getIndexedBy())) { |
|
| 65 | + if ( ! ($association instanceof ToManyAssociationMetadata && $association->getIndexedBy())) { |
|
| 66 | 66 | throw new \BadMethodCallException("Selecting a collection by index is only supported on indexed collections."); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | { |
| 112 | 112 | $association = $collection->getMapping(); |
| 113 | 113 | |
| 114 | - if (! ($association instanceof ToManyAssociationMetadata && $association->getIndexedBy())) { |
|
| 114 | + if ( ! ($association instanceof ToManyAssociationMetadata && $association->getIndexedBy())) { |
|
| 115 | 115 | throw new \BadMethodCallException("Selecting a collection by index is only supported on indexed collections."); |
| 116 | 116 | } |
| 117 | 117 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | // only works with single id identifier entities. Will throw an |
| 121 | 121 | // exception in Entity Persisters if that is not the case for the |
| 122 | 122 | // 'mappedBy' field. |
| 123 | - $criteria = [ |
|
| 123 | + $criteria = [ |
|
| 124 | 124 | $association->getMappedBy() => $collection->getOwner(), |
| 125 | 125 | $association->getIndexedBy() => $key, |
| 126 | 126 | ]; |
@@ -157,12 +157,12 @@ discard block |
||
| 157 | 157 | { |
| 158 | 158 | $association = $collection->getMapping(); |
| 159 | 159 | |
| 160 | - if (! $association->isOrphanRemoval()) { |
|
| 160 | + if ( ! $association->isOrphanRemoval()) { |
|
| 161 | 161 | // no-op: this is not the owning side, therefore no operations should be applied |
| 162 | 162 | return false; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if (! $this->isValidEntityState($element)) { |
|
| 165 | + if ( ! $this->isValidEntityState($element)) { |
|
| 166 | 166 | return false; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | $tableName = $targetClass->table->getQuotedQualifiedName($this->platform); |
| 205 | - $statement = 'DELETE FROM ' . $tableName . ' WHERE ' . implode(' = ? AND ', $columns) . ' = ?'; |
|
| 205 | + $statement = 'DELETE FROM '.$tableName.' WHERE '.implode(' = ? AND ', $columns).' = ?'; |
|
| 206 | 206 | |
| 207 | 207 | return $this->conn->executeUpdate($statement, $parameters); |
| 208 | 208 | } |
@@ -241,17 +241,17 @@ discard block |
||
| 241 | 241 | ]; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - $statement = $this->platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable |
|
| 245 | - . ' (' . $this->platform->getColumnDeclarationListSQL($columnDefinitions) . ')'; |
|
| 244 | + $statement = $this->platform->getCreateTemporaryTableSnippetSQL().' '.$tempTable |
|
| 245 | + . ' ('.$this->platform->getColumnDeclarationListSQL($columnDefinitions).')'; |
|
| 246 | 246 | |
| 247 | 247 | $this->conn->executeUpdate($statement); |
| 248 | 248 | |
| 249 | 249 | // 2) Build insert table records into temporary table |
| 250 | - $dql = ' SELECT t0.' . implode(', t0.', $rootClass->getIdentifierFieldNames()) |
|
| 251 | - . ' FROM ' . $targetClass->getClassName() . ' t0 WHERE t0.' . $association->getMappedBy() . ' = :owner'; |
|
| 250 | + $dql = ' SELECT t0.'.implode(', t0.', $rootClass->getIdentifierFieldNames()) |
|
| 251 | + . ' FROM '.$targetClass->getClassName().' t0 WHERE t0.'.$association->getMappedBy().' = :owner'; |
|
| 252 | 252 | $query = $this->em->createQuery($dql)->setParameter('owner', $collection->getOwner()); |
| 253 | 253 | |
| 254 | - $statement = 'INSERT INTO ' . $tempTable . ' (' . $idColumnNameList . ') ' . $query->getSQL(); |
|
| 254 | + $statement = 'INSERT INTO '.$tempTable.' ('.$idColumnNameList.') '.$query->getSQL(); |
|
| 255 | 255 | $parameters = array_values($sourcePersister->getIdentifier($collection->getOwner())); |
| 256 | 256 | $numDeleted = $this->conn->executeUpdate($statement, $parameters); |
| 257 | 257 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | // 4) Delete records on each table in the hierarchy |
| 267 | 267 | $hierarchyClasses = array_merge( |
| 268 | 268 | array_map( |
| 269 | - function ($className) { return $this->em->getClassMetadata($className); }, |
|
| 269 | + function($className) { return $this->em->getClassMetadata($className); }, |
|
| 270 | 270 | array_reverse($targetClass->getSubClasses()) |
| 271 | 271 | ), |
| 272 | 272 | [$targetClass], |
@@ -1409,7 +1409,6 @@ |
||
| 1409 | 1409 | * Gets the SQL join fragment used when selecting entities from a |
| 1410 | 1410 | * many-to-many association. |
| 1411 | 1411 | * |
| 1412 | - * @param ManyToManyAssociationMetadata $manyToMany |
|
| 1413 | 1412 | * |
| 1414 | 1413 | * @return string |
| 1415 | 1414 | */ |
@@ -323,8 +323,8 @@ discard block |
||
| 323 | 323 | |
| 324 | 324 | // FIXME: Order with composite keys might not be correct |
| 325 | 325 | $sql = 'SELECT ' . $columnName |
| 326 | - . ' FROM ' . $tableName |
|
| 327 | - . ' WHERE ' . implode(' = ? AND ', $identifier) . ' = ?'; |
|
| 326 | + . ' FROM ' . $tableName |
|
| 327 | + . ' WHERE ' . implode(' = ? AND ', $identifier) . ' = ?'; |
|
| 328 | 328 | |
| 329 | 329 | $flattenedId = $this->em->getIdentifierFlattener()->flattenIdentifier($versionedClass, $id); |
| 330 | 330 | $versionType = $versionProperty->getType(); |
@@ -457,8 +457,8 @@ discard block |
||
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | $sql = 'UPDATE ' . $quotedTableName |
| 460 | - . ' SET ' . implode(', ', $set) |
|
| 461 | - . ' WHERE ' . implode(' = ? AND ', $where) . ' = ?'; |
|
| 460 | + . ' SET ' . implode(', ', $set) |
|
| 461 | + . ' WHERE ' . implode(' = ? AND ', $where) . ' = ?'; |
|
| 462 | 462 | |
| 463 | 463 | $result = $this->conn->executeUpdate($sql, $params, $types); |
| 464 | 464 | |
@@ -1626,9 +1626,9 @@ discard block |
||
| 1626 | 1626 | $lock = $this->getLockTablesSql($lockMode); |
| 1627 | 1627 | $where = ($conditionSql ? ' WHERE ' . $conditionSql : '') . ' '; |
| 1628 | 1628 | $sql = 'SELECT 1 ' |
| 1629 | - . $lock |
|
| 1630 | - . $where |
|
| 1631 | - . $lockSql; |
|
| 1629 | + . $lock |
|
| 1630 | + . $where |
|
| 1631 | + . $lockSql; |
|
| 1632 | 1632 | |
| 1633 | 1633 | list($params, $types) = $this->expandParameters($criteria); |
| 1634 | 1634 | |
@@ -2107,8 +2107,8 @@ discard block |
||
| 2107 | 2107 | $alias = $this->getSQLTableAlias($this->class->getTableName()); |
| 2108 | 2108 | |
| 2109 | 2109 | $sql = 'SELECT 1 ' |
| 2110 | - . $this->getLockTablesSql(null) |
|
| 2111 | - . ' WHERE ' . $this->getSelectConditionSQL($criteria); |
|
| 2110 | + . $this->getLockTablesSql(null) |
|
| 2111 | + . ' WHERE ' . $this->getSelectConditionSQL($criteria); |
|
| 2112 | 2112 | |
| 2113 | 2113 | list($params, $types) = $this->expandParameters($criteria); |
| 2114 | 2114 | |
@@ -2142,9 +2142,9 @@ discard block |
||
| 2142 | 2142 | |
| 2143 | 2143 | // if one of the join columns is nullable, return left join |
| 2144 | 2144 | foreach ($association->getJoinColumns() as $joinColumn) { |
| 2145 | - if (! $joinColumn->isNullable()) { |
|
| 2146 | - continue; |
|
| 2147 | - } |
|
| 2145 | + if (! $joinColumn->isNullable()) { |
|
| 2146 | + continue; |
|
| 2147 | + } |
|
| 2148 | 2148 | |
| 2149 | 2149 | return 'LEFT JOIN'; |
| 2150 | 2150 | } |
@@ -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\ORM\Persisters\Entity; |
| 6 | 6 | |
@@ -300,14 +300,14 @@ discard block |
||
| 300 | 300 | $tableName = $versionedClass->table->getQuotedQualifiedName($this->platform); |
| 301 | 301 | $columnName = $this->platform->quoteIdentifier($versionProperty->getColumnName()); |
| 302 | 302 | $identifier = array_map( |
| 303 | - function ($columnName) { return $this->platform->quoteIdentifier($columnName); }, |
|
| 303 | + function($columnName) { return $this->platform->quoteIdentifier($columnName); }, |
|
| 304 | 304 | array_keys($versionedClass->getIdentifierColumns($this->em)) |
| 305 | 305 | ); |
| 306 | 306 | |
| 307 | 307 | // FIXME: Order with composite keys might not be correct |
| 308 | - $sql = 'SELECT ' . $columnName |
|
| 309 | - . ' FROM ' . $tableName |
|
| 310 | - . ' WHERE ' . implode(' = ? AND ', $identifier) . ' = ?'; |
|
| 308 | + $sql = 'SELECT '.$columnName |
|
| 309 | + . ' FROM '.$tableName |
|
| 310 | + . ' WHERE '.implode(' = ? AND ', $identifier).' = ?'; |
|
| 311 | 311 | |
| 312 | 312 | $flattenedId = $this->em->getIdentifierFlattener()->flattenIdentifier($versionedClass, $id); |
| 313 | 313 | $versionType = $versionProperty->getType(); |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | |
| 394 | 394 | if (($value = $identifier[$field]) !== null) { |
| 395 | 395 | // @todo guilhermeblanco Make sure we do not have flat association values. |
| 396 | - if (! is_array($value)) { |
|
| 396 | + if ( ! is_array($value)) { |
|
| 397 | 397 | $value = [$targetClass->identifier[0] => $value]; |
| 398 | 398 | } |
| 399 | 399 | |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
| 407 | 407 | $targetField = $targetClass->fieldNames[$referencedColumnName]; |
| 408 | 408 | |
| 409 | - if (! $joinColumn->getType()) { |
|
| 409 | + if ( ! $joinColumn->getType()) { |
|
| 410 | 410 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $this->em)); |
| 411 | 411 | } |
| 412 | 412 | |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | $quotedColumnName = $this->platform->quoteIdentifier($joinColumn->getColumnName()); |
| 475 | 475 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
| 476 | 476 | |
| 477 | - if (! $joinColumn->getType()) { |
|
| 477 | + if ( ! $joinColumn->getType()) { |
|
| 478 | 478 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $this->em)); |
| 479 | 479 | } |
| 480 | 480 | |
@@ -501,18 +501,18 @@ discard block |
||
| 501 | 501 | case Type::SMALLINT: |
| 502 | 502 | case Type::INTEGER: |
| 503 | 503 | case Type::BIGINT: |
| 504 | - $set[] = $versionColumnName . ' = ' . $versionColumnName . ' + 1'; |
|
| 504 | + $set[] = $versionColumnName.' = '.$versionColumnName.' + 1'; |
|
| 505 | 505 | break; |
| 506 | 506 | |
| 507 | 507 | case Type::DATETIME: |
| 508 | - $set[] = $versionColumnName . ' = CURRENT_TIMESTAMP'; |
|
| 508 | + $set[] = $versionColumnName.' = CURRENT_TIMESTAMP'; |
|
| 509 | 509 | break; |
| 510 | 510 | } |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - $sql = 'UPDATE ' . $quotedTableName |
|
| 514 | - . ' SET ' . implode(', ', $set) |
|
| 515 | - . ' WHERE ' . implode(' = ? AND ', $where) . ' = ?'; |
|
| 513 | + $sql = 'UPDATE '.$quotedTableName |
|
| 514 | + . ' SET '.implode(', ', $set) |
|
| 515 | + . ' WHERE '.implode(' = ? AND ', $where).' = ?'; |
|
| 516 | 516 | |
| 517 | 517 | $result = $this->conn->executeUpdate($sql, $params, $types); |
| 518 | 518 | |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | protected function deleteJoinTableRecords($identifier) |
| 532 | 532 | { |
| 533 | 533 | foreach ($this->class->getDeclaredPropertiesIterator() as $association) { |
| 534 | - if (! ($association instanceof ManyToManyAssociationMetadata)) { |
|
| 534 | + if ( ! ($association instanceof ManyToManyAssociationMetadata)) { |
|
| 535 | 535 | continue; |
| 536 | 536 | } |
| 537 | 537 | |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | $keys = []; |
| 545 | 545 | |
| 546 | 546 | if ( ! $owningAssociation->isOwningSide()) { |
| 547 | - $class = $this->em->getClassMetadata($association->getTargetEntity()); |
|
| 547 | + $class = $this->em->getClassMetadata($association->getTargetEntity()); |
|
| 548 | 548 | $owningAssociation = $class->getProperty($association->getMappedBy()); |
| 549 | 549 | } |
| 550 | 550 | |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | // Only owning side of x-1 associations can have a FK column. |
| 659 | - if (! $property instanceof ToOneAssociationMetadata || ! $property->isOwningSide()) { |
|
| 659 | + if ( ! $property instanceof ToOneAssociationMetadata || ! $property->isOwningSide()) { |
|
| 660 | 660 | continue; |
| 661 | 661 | } |
| 662 | 662 | |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | /** @var JoinColumnMetadata $joinColumn */ |
| 677 | 677 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
| 678 | 678 | |
| 679 | - if (! $joinColumn->getType()) { |
|
| 679 | + if ( ! $joinColumn->getType()) { |
|
| 680 | 680 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $this->em)); |
| 681 | 681 | } |
| 682 | 682 | |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | $propertyName = $this->class->fieldNames[$columnName]; |
| 706 | 706 | $property = $this->class->getProperty($propertyName); |
| 707 | 707 | |
| 708 | - if (! $property) { |
|
| 708 | + if ( ! $property) { |
|
| 709 | 709 | return null; |
| 710 | 710 | } |
| 711 | 711 | |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | /** @var JoinColumnMetadata $joinColumn */ |
| 725 | 725 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
| 726 | 726 | |
| 727 | - if (! $joinColumn->getType()) { |
|
| 727 | + if ( ! $joinColumn->getType()) { |
|
| 728 | 728 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $this->em)); |
| 729 | 729 | } |
| 730 | 730 | |
@@ -841,7 +841,7 @@ discard block |
||
| 841 | 841 | // unset the old value and set the new sql aliased value here. By definition |
| 842 | 842 | // unset($identifier[$targetKeyColumn] works here with how UnitOfWork::createEntity() calls this method. |
| 843 | 843 | // @todo guilhermeblanco In master we have: $identifier[$targetClass->getFieldForColumn($targetKeyColumn)] = |
| 844 | - $identifier[$targetTableAlias . "." . $targetKeyColumn] = $value; |
|
| 844 | + $identifier[$targetTableAlias.".".$targetKeyColumn] = $value; |
|
| 845 | 845 | |
| 846 | 846 | unset($identifier[$targetKeyColumn]); |
| 847 | 847 | } |
@@ -1061,7 +1061,7 @@ discard block |
||
| 1061 | 1061 | $criteria = []; |
| 1062 | 1062 | $parameters = []; |
| 1063 | 1063 | |
| 1064 | - if (! $association->isOwningSide()) { |
|
| 1064 | + if ( ! $association->isOwningSide()) { |
|
| 1065 | 1065 | $class = $this->em->getClassMetadata($association->getTargetEntity()); |
| 1066 | 1066 | $owningAssoc = $class->getProperty($association->getMappedBy()); |
| 1067 | 1067 | } |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | $value = $value[$targetClass->identifier[0]]; |
| 1090 | 1090 | } |
| 1091 | 1091 | |
| 1092 | - $criteria[$joinTableName . '.' . $quotedColumnName] = $value; |
|
| 1092 | + $criteria[$joinTableName.'.'.$quotedColumnName] = $value; |
|
| 1093 | 1093 | $parameters[] = [ |
| 1094 | 1094 | 'value' => $value, |
| 1095 | 1095 | 'field' => $fieldName, |
@@ -1140,11 +1140,11 @@ discard block |
||
| 1140 | 1140 | |
| 1141 | 1141 | switch ($lockMode) { |
| 1142 | 1142 | case LockMode::PESSIMISTIC_READ: |
| 1143 | - $lockSql = ' ' . $this->platform->getReadLockSQL(); |
|
| 1143 | + $lockSql = ' '.$this->platform->getReadLockSQL(); |
|
| 1144 | 1144 | break; |
| 1145 | 1145 | |
| 1146 | 1146 | case LockMode::PESSIMISTIC_WRITE: |
| 1147 | - $lockSql = ' ' . $this->platform->getWriteLockSQL(); |
|
| 1147 | + $lockSql = ' '.$this->platform->getWriteLockSQL(); |
|
| 1148 | 1148 | break; |
| 1149 | 1149 | } |
| 1150 | 1150 | |
@@ -1155,14 +1155,14 @@ discard block |
||
| 1155 | 1155 | |
| 1156 | 1156 | if ('' !== $filterSql) { |
| 1157 | 1157 | $conditionSql = $conditionSql |
| 1158 | - ? $conditionSql . ' AND ' . $filterSql |
|
| 1158 | + ? $conditionSql.' AND '.$filterSql |
|
| 1159 | 1159 | : $filterSql; |
| 1160 | 1160 | } |
| 1161 | 1161 | |
| 1162 | - $select = 'SELECT ' . $columnList; |
|
| 1163 | - $from = ' FROM ' . $tableName . ' '. $tableAlias; |
|
| 1164 | - $join = $this->currentPersisterContext->selectJoinSql . $joinSql; |
|
| 1165 | - $where = ($conditionSql ? ' WHERE ' . $conditionSql : ''); |
|
| 1162 | + $select = 'SELECT '.$columnList; |
|
| 1163 | + $from = ' FROM '.$tableName.' '.$tableAlias; |
|
| 1164 | + $join = $this->currentPersisterContext->selectJoinSql.$joinSql; |
|
| 1165 | + $where = ($conditionSql ? ' WHERE '.$conditionSql : ''); |
|
| 1166 | 1166 | $lock = $this->platform->appendLockHint($from, $lockMode); |
| 1167 | 1167 | $query = $select |
| 1168 | 1168 | . $lock |
@@ -1170,7 +1170,7 @@ discard block |
||
| 1170 | 1170 | . $where |
| 1171 | 1171 | . $orderBySql; |
| 1172 | 1172 | |
| 1173 | - return $this->platform->modifyLimitQuery($query, $limit, $offset) . $lockSql; |
|
| 1173 | + return $this->platform->modifyLimitQuery($query, $limit, $offset).$lockSql; |
|
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | 1176 | /** |
@@ -1189,13 +1189,13 @@ discard block |
||
| 1189 | 1189 | |
| 1190 | 1190 | if ('' !== $filterSql) { |
| 1191 | 1191 | $conditionSql = $conditionSql |
| 1192 | - ? $conditionSql . ' AND ' . $filterSql |
|
| 1192 | + ? $conditionSql.' AND '.$filterSql |
|
| 1193 | 1193 | : $filterSql; |
| 1194 | 1194 | } |
| 1195 | 1195 | |
| 1196 | 1196 | $sql = 'SELECT COUNT(*) ' |
| 1197 | - . 'FROM ' . $tableName . ' ' . $tableAlias |
|
| 1198 | - . (empty($conditionSql) ? '' : ' WHERE ' . $conditionSql); |
|
| 1197 | + . 'FROM '.$tableName.' '.$tableAlias |
|
| 1198 | + . (empty($conditionSql) ? '' : ' WHERE '.$conditionSql); |
|
| 1199 | 1199 | |
| 1200 | 1200 | return $sql; |
| 1201 | 1201 | } |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | */ |
| 1213 | 1213 | protected final function getOrderBySQL(array $orderBy, $baseTableAlias) |
| 1214 | 1214 | { |
| 1215 | - if (! $orderBy) { |
|
| 1215 | + if ( ! $orderBy) { |
|
| 1216 | 1216 | return ''; |
| 1217 | 1217 | } |
| 1218 | 1218 | |
@@ -1221,7 +1221,7 @@ discard block |
||
| 1221 | 1221 | foreach ($orderBy as $fieldName => $orientation) { |
| 1222 | 1222 | $orientation = strtoupper(trim($orientation)); |
| 1223 | 1223 | |
| 1224 | - if (! in_array($orientation, ['ASC', 'DESC'])) { |
|
| 1224 | + if ( ! in_array($orientation, ['ASC', 'DESC'])) { |
|
| 1225 | 1225 | throw ORMException::invalidOrientation($this->class->getClassName(), $fieldName); |
| 1226 | 1226 | } |
| 1227 | 1227 | |
@@ -1231,11 +1231,11 @@ discard block |
||
| 1231 | 1231 | $tableAlias = $this->getSQLTableAlias($property->getTableName()); |
| 1232 | 1232 | $columnName = $this->platform->quoteIdentifier($property->getColumnName()); |
| 1233 | 1233 | |
| 1234 | - $orderByList[] = $tableAlias . '.' . $columnName . ' ' . $orientation; |
|
| 1234 | + $orderByList[] = $tableAlias.'.'.$columnName.' '.$orientation; |
|
| 1235 | 1235 | |
| 1236 | 1236 | continue; |
| 1237 | 1237 | } else if ($property instanceof AssociationMetadata) { |
| 1238 | - if (! $property->isOwningSide()) { |
|
| 1238 | + if ( ! $property->isOwningSide()) { |
|
| 1239 | 1239 | throw ORMException::invalidFindByInverseAssociation($this->class->getClassName(), $fieldName); |
| 1240 | 1240 | } |
| 1241 | 1241 | |
@@ -1248,7 +1248,7 @@ discard block |
||
| 1248 | 1248 | /* @var JoinColumnMetadata $joinColumn */ |
| 1249 | 1249 | $quotedColumnName = $this->platform->quoteIdentifier($joinColumn->getColumnName()); |
| 1250 | 1250 | |
| 1251 | - $orderByList[] = $tableAlias . '.' . $quotedColumnName . ' ' . $orientation; |
|
| 1251 | + $orderByList[] = $tableAlias.'.'.$quotedColumnName.' '.$orientation; |
|
| 1252 | 1252 | } |
| 1253 | 1253 | |
| 1254 | 1254 | continue; |
@@ -1257,7 +1257,7 @@ discard block |
||
| 1257 | 1257 | throw ORMException::unrecognizedField($fieldName); |
| 1258 | 1258 | } |
| 1259 | 1259 | |
| 1260 | - return ' ORDER BY ' . implode(', ', $orderByList); |
|
| 1260 | + return ' ORDER BY '.implode(', ', $orderByList); |
|
| 1261 | 1261 | } |
| 1262 | 1262 | |
| 1263 | 1263 | /** |
@@ -1279,7 +1279,7 @@ discard block |
||
| 1279 | 1279 | |
| 1280 | 1280 | |
| 1281 | 1281 | $this->currentPersisterContext->rsm->addEntityResult($this->class->getClassName(), 'r'); // r for root |
| 1282 | - $this->currentPersisterContext->selectJoinSql = ''; |
|
| 1282 | + $this->currentPersisterContext->selectJoinSql = ''; |
|
| 1283 | 1283 | |
| 1284 | 1284 | $eagerAliasCounter = 0; |
| 1285 | 1285 | $columnList = []; |
@@ -1315,7 +1315,7 @@ discard block |
||
| 1315 | 1315 | break; // now this is why you shouldn't use inheritance |
| 1316 | 1316 | } |
| 1317 | 1317 | |
| 1318 | - $assocAlias = 'e' . ($eagerAliasCounter++); |
|
| 1318 | + $assocAlias = 'e'.($eagerAliasCounter++); |
|
| 1319 | 1319 | |
| 1320 | 1320 | $this->currentPersisterContext->rsm->addJoinedEntityResult($targetEntity, $assocAlias, 'r', $fieldName); |
| 1321 | 1321 | |
@@ -1340,14 +1340,14 @@ discard block |
||
| 1340 | 1340 | $this->currentPersisterContext->rsm->addIndexBy($assocAlias, $property->getIndexedBy()); |
| 1341 | 1341 | } |
| 1342 | 1342 | |
| 1343 | - if (! $property->isOwningSide()) { |
|
| 1343 | + if ( ! $property->isOwningSide()) { |
|
| 1344 | 1344 | $owningAssociation = $eagerEntity->getProperty($property->getMappedBy()); |
| 1345 | 1345 | } |
| 1346 | 1346 | |
| 1347 | 1347 | $joinTableAlias = $this->getSQLTableAlias($eagerEntity->getTableName(), $assocAlias); |
| 1348 | 1348 | $joinTableName = $eagerEntity->table->getQuotedQualifiedName($this->platform); |
| 1349 | 1349 | |
| 1350 | - $this->currentPersisterContext->selectJoinSql .= ' ' . $this->getJoinSQLForAssociation($property); |
|
| 1350 | + $this->currentPersisterContext->selectJoinSql .= ' '.$this->getJoinSQLForAssociation($property); |
|
| 1351 | 1351 | |
| 1352 | 1352 | $sourceClass = $this->em->getClassMetadata($owningAssociation->getSourceEntity()); |
| 1353 | 1353 | $targetClass = $this->em->getClassMetadata($owningAssociation->getTargetEntity()); |
@@ -1369,7 +1369,7 @@ discard block |
||
| 1369 | 1369 | $joinCondition[] = $filterSql; |
| 1370 | 1370 | } |
| 1371 | 1371 | |
| 1372 | - $this->currentPersisterContext->selectJoinSql .= ' ' . $joinTableName . ' ' . $joinTableAlias . ' ON '; |
|
| 1372 | + $this->currentPersisterContext->selectJoinSql .= ' '.$joinTableName.' '.$joinTableAlias.' ON '; |
|
| 1373 | 1373 | $this->currentPersisterContext->selectJoinSql .= implode(' AND ', $joinCondition); |
| 1374 | 1374 | |
| 1375 | 1375 | break; |
@@ -1393,7 +1393,7 @@ discard block |
||
| 1393 | 1393 | */ |
| 1394 | 1394 | protected function getSelectColumnAssociationSQL($field, AssociationMetadata $association, ClassMetadata $class, $alias = 'r') |
| 1395 | 1395 | { |
| 1396 | - if (! ($association->isOwningSide() && $association instanceof ToOneAssociationMetadata)) { |
|
| 1396 | + if ( ! ($association->isOwningSide() && $association instanceof ToOneAssociationMetadata)) { |
|
| 1397 | 1397 | return ''; |
| 1398 | 1398 | } |
| 1399 | 1399 | |
@@ -1408,7 +1408,7 @@ discard block |
||
| 1408 | 1408 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
| 1409 | 1409 | $resultColumnName = $this->getSQLColumnAlias(); |
| 1410 | 1410 | |
| 1411 | - if (! $joinColumn->getType()) { |
|
| 1411 | + if ( ! $joinColumn->getType()) { |
|
| 1412 | 1412 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $this->em)); |
| 1413 | 1413 | } |
| 1414 | 1414 | |
@@ -1440,7 +1440,7 @@ discard block |
||
| 1440 | 1440 | $owningAssociation = $association; |
| 1441 | 1441 | $sourceTableAlias = $this->getSQLTableAlias($this->class->getTableName()); |
| 1442 | 1442 | |
| 1443 | - if (! $association->isOwningSide()) { |
|
| 1443 | + if ( ! $association->isOwningSide()) { |
|
| 1444 | 1444 | $targetEntity = $this->em->getClassMetadata($association->getTargetEntity()); |
| 1445 | 1445 | $owningAssociation = $targetEntity->getProperty($association->getMappedBy()); |
| 1446 | 1446 | } |
@@ -1462,7 +1462,7 @@ discard block |
||
| 1462 | 1462 | ); |
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | - return ' INNER JOIN ' . $joinTableName . ' ON ' . implode(' AND ', $conditions); |
|
| 1465 | + return ' INNER JOIN '.$joinTableName.' ON '.implode(' AND ', $conditions); |
|
| 1466 | 1466 | } |
| 1467 | 1467 | |
| 1468 | 1468 | /** |
@@ -1557,7 +1557,7 @@ discard block |
||
| 1557 | 1557 | $columnName = $joinColumn->getColumnName(); |
| 1558 | 1558 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
| 1559 | 1559 | |
| 1560 | - if (! $joinColumn->getType()) { |
|
| 1560 | + if ( ! $joinColumn->getType()) { |
|
| 1561 | 1561 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $this->em)); |
| 1562 | 1562 | } |
| 1563 | 1563 | |
@@ -1596,7 +1596,7 @@ discard block |
||
| 1596 | 1596 | |
| 1597 | 1597 | $this->currentPersisterContext->rsm->addFieldResult($alias, $columnAlias, $field, $class->getClassName()); |
| 1598 | 1598 | |
| 1599 | - return $property->getType()->convertToPHPValueSQL($sql, $this->platform) . ' AS ' . $columnAlias; |
|
| 1599 | + return $property->getType()->convertToPHPValueSQL($sql, $this->platform).' AS '.$columnAlias; |
|
| 1600 | 1600 | } |
| 1601 | 1601 | |
| 1602 | 1602 | /** |
@@ -1610,14 +1610,14 @@ discard block |
||
| 1610 | 1610 | protected function getSQLTableAlias($tableName, $assocName = '') |
| 1611 | 1611 | { |
| 1612 | 1612 | if ($tableName) { |
| 1613 | - $tableName .= '#' . $assocName; |
|
| 1613 | + $tableName .= '#'.$assocName; |
|
| 1614 | 1614 | } |
| 1615 | 1615 | |
| 1616 | 1616 | if (isset($this->currentPersisterContext->sqlTableAliases[$tableName])) { |
| 1617 | 1617 | return $this->currentPersisterContext->sqlTableAliases[$tableName]; |
| 1618 | 1618 | } |
| 1619 | 1619 | |
| 1620 | - $tableAlias = 't' . $this->currentPersisterContext->sqlAliasCounter++; |
|
| 1620 | + $tableAlias = 't'.$this->currentPersisterContext->sqlAliasCounter++; |
|
| 1621 | 1621 | |
| 1622 | 1622 | $this->currentPersisterContext->sqlTableAliases[$tableName] = $tableAlias; |
| 1623 | 1623 | |
@@ -1644,7 +1644,7 @@ discard block |
||
| 1644 | 1644 | } |
| 1645 | 1645 | |
| 1646 | 1646 | $lock = $this->getLockTablesSql($lockMode); |
| 1647 | - $where = ($conditionSql ? ' WHERE ' . $conditionSql : '') . ' '; |
|
| 1647 | + $where = ($conditionSql ? ' WHERE '.$conditionSql : '').' '; |
|
| 1648 | 1648 | $sql = 'SELECT 1 ' |
| 1649 | 1649 | . $lock |
| 1650 | 1650 | . $where |
@@ -1667,7 +1667,7 @@ discard block |
||
| 1667 | 1667 | $tableName = $this->class->table->getQuotedQualifiedName($this->platform); |
| 1668 | 1668 | |
| 1669 | 1669 | return $this->platform->appendLockHint( |
| 1670 | - 'FROM ' . $tableName . ' ' . $this->getSQLTableAlias($this->class->getTableName()), |
|
| 1670 | + 'FROM '.$tableName.' '.$this->getSQLTableAlias($this->class->getTableName()), |
|
| 1671 | 1671 | $lockMode |
| 1672 | 1672 | ); |
| 1673 | 1673 | } |
@@ -1720,19 +1720,19 @@ discard block |
||
| 1720 | 1720 | |
| 1721 | 1721 | if (null !== $comparison) { |
| 1722 | 1722 | // special case null value handling |
| 1723 | - if (($comparison === Comparison::EQ || $comparison === Comparison::IS) && null ===$value) { |
|
| 1724 | - $selectedColumns[] = $column . ' IS NULL'; |
|
| 1723 | + if (($comparison === Comparison::EQ || $comparison === Comparison::IS) && null === $value) { |
|
| 1724 | + $selectedColumns[] = $column.' IS NULL'; |
|
| 1725 | 1725 | |
| 1726 | 1726 | continue; |
| 1727 | 1727 | } |
| 1728 | 1728 | |
| 1729 | 1729 | if ($comparison === Comparison::NEQ && null === $value) { |
| 1730 | - $selectedColumns[] = $column . ' IS NOT NULL'; |
|
| 1730 | + $selectedColumns[] = $column.' IS NOT NULL'; |
|
| 1731 | 1731 | |
| 1732 | 1732 | continue; |
| 1733 | 1733 | } |
| 1734 | 1734 | |
| 1735 | - $selectedColumns[] = $column . ' ' . sprintf(self::$comparisonMap[$comparison], $placeholder); |
|
| 1735 | + $selectedColumns[] = $column.' '.sprintf(self::$comparisonMap[$comparison], $placeholder); |
|
| 1736 | 1736 | |
| 1737 | 1737 | continue; |
| 1738 | 1738 | } |
@@ -1781,7 +1781,7 @@ discard block |
||
| 1781 | 1781 | $tableAlias = $this->getSQLTableAlias($property->getTableName()); |
| 1782 | 1782 | $columnName = $this->platform->quoteIdentifier($property->getColumnName()); |
| 1783 | 1783 | |
| 1784 | - return [$tableAlias . '.' . $columnName]; |
|
| 1784 | + return [$tableAlias.'.'.$columnName]; |
|
| 1785 | 1785 | } |
| 1786 | 1786 | |
| 1787 | 1787 | if ($property instanceof AssociationMetadata) { |
@@ -1790,7 +1790,7 @@ discard block |
||
| 1790 | 1790 | |
| 1791 | 1791 | // Many-To-Many requires join table check for joinColumn |
| 1792 | 1792 | if ($owningAssociation instanceof ManyToManyAssociationMetadata) { |
| 1793 | - if (! $owningAssociation->isOwningSide()) { |
|
| 1793 | + if ( ! $owningAssociation->isOwningSide()) { |
|
| 1794 | 1794 | $owningAssociation = $association; |
| 1795 | 1795 | } |
| 1796 | 1796 | |
@@ -1804,15 +1804,15 @@ discard block |
||
| 1804 | 1804 | foreach ($joinColumns as $joinColumn) { |
| 1805 | 1805 | $quotedColumnName = $this->platform->quoteIdentifier($joinColumn->getColumnName()); |
| 1806 | 1806 | |
| 1807 | - $columns[] = $joinTableName . '.' . $quotedColumnName; |
|
| 1807 | + $columns[] = $joinTableName.'.'.$quotedColumnName; |
|
| 1808 | 1808 | } |
| 1809 | 1809 | |
| 1810 | 1810 | } else { |
| 1811 | - if (! $owningAssociation->isOwningSide()) { |
|
| 1811 | + if ( ! $owningAssociation->isOwningSide()) { |
|
| 1812 | 1812 | throw ORMException::invalidFindByInverseAssociation($this->class->getClassName(), $field); |
| 1813 | 1813 | } |
| 1814 | 1814 | |
| 1815 | - $class = $this->class->isInheritedProperty($field) |
|
| 1815 | + $class = $this->class->isInheritedProperty($field) |
|
| 1816 | 1816 | ? $owningAssociation->getDeclaringClass() |
| 1817 | 1817 | : $this->class |
| 1818 | 1818 | ; |
@@ -1821,7 +1821,7 @@ discard block |
||
| 1821 | 1821 | foreach ($owningAssociation->getJoinColumns() as $joinColumn) { |
| 1822 | 1822 | $quotedColumnName = $this->platform->quoteIdentifier($joinColumn->getColumnName()); |
| 1823 | 1823 | |
| 1824 | - $columns[] = $tableAlias . '.' . $quotedColumnName; |
|
| 1824 | + $columns[] = $tableAlias.'.'.$quotedColumnName; |
|
| 1825 | 1825 | } |
| 1826 | 1826 | } |
| 1827 | 1827 | |
@@ -1934,7 +1934,7 @@ discard block |
||
| 1934 | 1934 | $value = $value[$targetClass->identifier[0]]; |
| 1935 | 1935 | } |
| 1936 | 1936 | |
| 1937 | - $criteria[$tableAlias . "." . $quotedColumnName] = $value; |
|
| 1937 | + $criteria[$tableAlias.".".$quotedColumnName] = $value; |
|
| 1938 | 1938 | $parameters[] = [ |
| 1939 | 1939 | 'value' => $value, |
| 1940 | 1940 | 'field' => $fieldName, |
@@ -2021,7 +2021,7 @@ discard block |
||
| 2021 | 2021 | case ($property instanceof AssociationMetadata): |
| 2022 | 2022 | $class = $this->em->getClassMetadata($property->getTargetEntity()); |
| 2023 | 2023 | |
| 2024 | - if (! $property->isOwningSide()) { |
|
| 2024 | + if ( ! $property->isOwningSide()) { |
|
| 2025 | 2025 | $property = $class->getProperty($property->getMappedBy()); |
| 2026 | 2026 | $class = $this->em->getClassMetadata($property->getTargetEntity()); |
| 2027 | 2027 | } |
@@ -2035,7 +2035,7 @@ discard block |
||
| 2035 | 2035 | /** @var JoinColumnMetadata $joinColumn */ |
| 2036 | 2036 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
| 2037 | 2037 | |
| 2038 | - if (! $joinColumn->getType()) { |
|
| 2038 | + if ( ! $joinColumn->getType()) { |
|
| 2039 | 2039 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $class, $this->em)); |
| 2040 | 2040 | } |
| 2041 | 2041 | |
@@ -2050,7 +2050,7 @@ discard block |
||
| 2050 | 2050 | } |
| 2051 | 2051 | |
| 2052 | 2052 | if (is_array($value)) { |
| 2053 | - return array_map(function ($type) { |
|
| 2053 | + return array_map(function($type) { |
|
| 2054 | 2054 | return $type->getBindingType() + Connection::ARRAY_PARAM_OFFSET; |
| 2055 | 2055 | }, $types); |
| 2056 | 2056 | } |
@@ -2129,12 +2129,12 @@ discard block |
||
| 2129 | 2129 | |
| 2130 | 2130 | $sql = 'SELECT 1 ' |
| 2131 | 2131 | . $this->getLockTablesSql(null) |
| 2132 | - . ' WHERE ' . $this->getSelectConditionSQL($criteria); |
|
| 2132 | + . ' WHERE '.$this->getSelectConditionSQL($criteria); |
|
| 2133 | 2133 | |
| 2134 | 2134 | list($params, $types) = $this->expandParameters($criteria); |
| 2135 | 2135 | |
| 2136 | 2136 | if (null !== $extraConditions) { |
| 2137 | - $sql .= ' AND ' . $this->getSelectConditionCriteriaSQL($extraConditions); |
|
| 2137 | + $sql .= ' AND '.$this->getSelectConditionCriteriaSQL($extraConditions); |
|
| 2138 | 2138 | list($criteriaParams, $criteriaTypes) = $this->expandCriteriaParameters($extraConditions); |
| 2139 | 2139 | |
| 2140 | 2140 | $params = array_merge($params, $criteriaParams); |
@@ -2142,7 +2142,7 @@ discard block |
||
| 2142 | 2142 | } |
| 2143 | 2143 | |
| 2144 | 2144 | if ($filterSql = $this->generateFilterConditionSQL($this->class, $alias)) { |
| 2145 | - $sql .= ' AND ' . $filterSql; |
|
| 2145 | + $sql .= ' AND '.$filterSql; |
|
| 2146 | 2146 | } |
| 2147 | 2147 | |
| 2148 | 2148 | return (bool) $this->conn->fetchColumn($sql, $params, 0, $types); |
@@ -2157,13 +2157,13 @@ discard block |
||
| 2157 | 2157 | */ |
| 2158 | 2158 | protected function getJoinSQLForAssociation(AssociationMetadata $association) |
| 2159 | 2159 | { |
| 2160 | - if (! $association->isOwningSide()) { |
|
| 2160 | + if ( ! $association->isOwningSide()) { |
|
| 2161 | 2161 | return 'LEFT JOIN'; |
| 2162 | 2162 | } |
| 2163 | 2163 | |
| 2164 | 2164 | // if one of the join columns is nullable, return left join |
| 2165 | 2165 | foreach ($association->getJoinColumns() as $joinColumn) { |
| 2166 | - if (! $joinColumn->isNullable()) { |
|
| 2166 | + if ( ! $joinColumn->isNullable()) { |
|
| 2167 | 2167 | continue; |
| 2168 | 2168 | } |
| 2169 | 2169 | |
@@ -2180,7 +2180,7 @@ discard block |
||
| 2180 | 2180 | */ |
| 2181 | 2181 | public function getSQLColumnAlias() |
| 2182 | 2182 | { |
| 2183 | - return $this->platform->getSQLResultCasing('c' . $this->currentPersisterContext->sqlAliasCounter++); |
|
| 2183 | + return $this->platform->getSQLResultCasing('c'.$this->currentPersisterContext->sqlAliasCounter++); |
|
| 2184 | 2184 | } |
| 2185 | 2185 | |
| 2186 | 2186 | /** |
@@ -2197,13 +2197,13 @@ discard block |
||
| 2197 | 2197 | |
| 2198 | 2198 | foreach ($this->em->getFilters()->getEnabledFilters() as $filter) { |
| 2199 | 2199 | if ('' !== $filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias)) { |
| 2200 | - $filterClauses[] = '(' . $filterExpr . ')'; |
|
| 2200 | + $filterClauses[] = '('.$filterExpr.')'; |
|
| 2201 | 2201 | } |
| 2202 | 2202 | } |
| 2203 | 2203 | |
| 2204 | 2204 | $sql = implode(' AND ', $filterClauses); |
| 2205 | 2205 | |
| 2206 | - return $sql ? "(" . $sql . ")" : ""; // Wrap again to avoid "X or Y and FilterConditionSQL" |
|
| 2206 | + return $sql ? "(".$sql.")" : ""; // Wrap again to avoid "X or Y and FilterConditionSQL" |
|
| 2207 | 2207 | } |
| 2208 | 2208 | |
| 2209 | 2209 | /** |
@@ -22,9 +22,7 @@ |
||
| 22 | 22 | namespace Doctrine\ORM\Query\Exec; |
| 23 | 23 | |
| 24 | 24 | use Doctrine\DBAL\Connection; |
| 25 | -use Doctrine\ORM\Mapping\ColumnMetadata; |
|
| 26 | 25 | use Doctrine\ORM\Query\AST; |
| 27 | -use Doctrine\ORM\Utility\PersisterHelper; |
|
| 28 | 26 | |
| 29 | 27 | /** |
| 30 | 28 | * Executes the SQL statements for bulk DQL DELETE statements on classes in |
@@ -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\ORM\Query\Exec; |
| 6 | 6 | |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | // 1. Create an INSERT INTO temptable ... SELECT identifiers WHERE $AST->getWhereClause() |
| 62 | 62 | $sqlWalker->setSQLTableAlias($primaryClass->getTableName(), 'i0', $primaryDqlAlias); |
| 63 | 63 | |
| 64 | - $this->insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnNameList . ')' |
|
| 65 | - . ' SELECT i0.' . implode(', i0.', array_keys($idColumns)); |
|
| 64 | + $this->insertSql = 'INSERT INTO '.$tempTable.' ('.$idColumnNameList.')' |
|
| 65 | + . ' SELECT i0.'.implode(', i0.', array_keys($idColumns)); |
|
| 66 | 66 | |
| 67 | 67 | $rangeDecl = new AST\RangeVariableDeclaration($primaryClass->getClassName(), $primaryDqlAlias); |
| 68 | 68 | $fromClause = new AST\FromClause([new AST\IdentificationVariableDeclaration($rangeDecl, null, [])]); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | // 3. Create and store DELETE statements |
| 85 | 85 | $hierarchyClasses = array_merge( |
| 86 | 86 | array_map( |
| 87 | - function ($className) use ($em) { return $em->getClassMetadata($className); }, |
|
| 87 | + function($className) use ($em) { return $em->getClassMetadata($className); }, |
|
| 88 | 88 | array_reverse($primaryClass->getSubClasses()) |
| 89 | 89 | ), |
| 90 | 90 | [$primaryClass], |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | ]; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - $this->createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' (' |
|
| 109 | - . $platform->getColumnDeclarationListSQL($columnDefinitions) . ')'; |
|
| 108 | + $this->createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL().' '.$tempTable.' (' |
|
| 109 | + . $platform->getColumnDeclarationListSQL($columnDefinitions).')'; |
|
| 110 | 110 | |
| 111 | 111 | $this->dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable); |
| 112 | 112 | } |
@@ -22,10 +22,8 @@ |
||
| 22 | 22 | namespace Doctrine\ORM\Query\Exec; |
| 23 | 23 | |
| 24 | 24 | use Doctrine\DBAL\Connection; |
| 25 | -use Doctrine\ORM\Mapping\ColumnMetadata; |
|
| 26 | 25 | use Doctrine\ORM\Query\AST; |
| 27 | 26 | use Doctrine\ORM\Query\ParameterTypeInferer; |
| 28 | -use Doctrine\ORM\Utility\PersisterHelper; |
|
| 29 | 27 | |
| 30 | 28 | /** |
| 31 | 29 | * Executes the SQL statements for bulk DQL UPDATE statements on classes in |
@@ -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\ORM\Query\Exec; |
| 6 | 6 | |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | // 1. Create an INSERT INTO temptable ... SELECT identifiers WHERE $AST->getWhereClause() |
| 73 | 73 | $sqlWalker->setSQLTableAlias($primaryClass->getTableName(), 'i0', $updateClause->aliasIdentificationVariable); |
| 74 | 74 | |
| 75 | - $this->insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnNameList . ')' |
|
| 76 | - . ' SELECT i0.' . implode(', i0.', array_keys($idColumns)); |
|
| 75 | + $this->insertSql = 'INSERT INTO '.$tempTable.' ('.$idColumnNameList.')' |
|
| 76 | + . ' SELECT i0.'.implode(', i0.', array_keys($idColumns)); |
|
| 77 | 77 | |
| 78 | 78 | $rangeDecl = new AST\RangeVariableDeclaration($primaryClass->getClassName(), $updateClause->aliasIdentificationVariable); |
| 79 | 79 | $fromClause = new AST\FromClause([new AST\IdentificationVariableDeclaration($rangeDecl, null, [])]); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | // 3. Create and store UPDATE statements |
| 92 | 92 | $hierarchyClasses = array_merge( |
| 93 | 93 | array_map( |
| 94 | - function ($className) use ($em) { return $em->getClassMetadata($className); }, |
|
| 94 | + function($className) use ($em) { return $em->getClassMetadata($className); }, |
|
| 95 | 95 | array_reverse($primaryClass->getSubClasses()) |
| 96 | 96 | ), |
| 97 | 97 | [$primaryClass], |
@@ -145,8 +145,8 @@ discard block |
||
| 145 | 145 | ]; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $this->createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' (' |
|
| 149 | - . $platform->getColumnDeclarationListSQL($columnDefinitions) . ')'; |
|
| 148 | + $this->createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL().' '.$tempTable.' (' |
|
| 149 | + . $platform->getColumnDeclarationListSQL($columnDefinitions).')'; |
|
| 150 | 150 | |
| 151 | 151 | $this->dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable); |
| 152 | 152 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @param string $entityName Full or partial entity name |
| 166 | 166 | * @param EntityManagerInterface $entityManager |
| 167 | 167 | * |
| 168 | - * @return \Doctrine\ORM\Mapping\ClassMetadata |
|
| 168 | + * @return \Doctrine\Common\Persistence\Mapping\ClassMetadata |
|
| 169 | 169 | */ |
| 170 | 170 | private function getClassMetadata($entityName, EntityManagerInterface $entityManager) |
| 171 | 171 | { |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * @param string $label Label for the value |
| 249 | 249 | * @param mixed $value A Value to show |
| 250 | 250 | * |
| 251 | - * @return array |
|
| 251 | + * @return string[] |
|
| 252 | 252 | */ |
| 253 | 253 | private function formatField($label, $value) |
| 254 | 254 | { |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | * |
| 348 | 348 | * @param array $entityListeners |
| 349 | 349 | * |
| 350 | - * @return array |
|
| 350 | + * @return string[] |
|
| 351 | 351 | */ |
| 352 | 352 | private function formatEntityListeners(array $entityListeners) |
| 353 | 353 | { |
@@ -298,7 +298,7 @@ |
||
| 298 | 298 | |
| 299 | 299 | if ($property instanceof FieldMetadata) { |
| 300 | 300 | $output = array_merge($output, $this->formatColumn($property)); |
| 301 | - } else if ($property instanceof AssociationMetadata) { |
|
| 301 | + } else if ($property instanceof AssociationMetadata) { |
|
| 302 | 302 | // @todo guilhermeblanco Fix me! We are trying to iterate through an AssociationMetadata instance |
| 303 | 303 | foreach ($property as $field => $value) { |
| 304 | 304 | $output[] = $this->formatField(sprintf(' %s', $field), $this->formatValue($value)); |
@@ -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\ORM\Tools\Console\Command; |
| 6 | 6 | |
@@ -165,8 +165,8 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | $matches = array_filter( |
| 167 | 167 | $this->getMappedEntities($entityManager), |
| 168 | - function ($mappedEntity) use ($entityName) { |
|
| 169 | - return preg_match('{' . preg_quote($entityName) . '}', $mappedEntity); |
|
| 168 | + function($mappedEntity) use ($entityName) { |
|
| 169 | + return preg_match('{'.preg_quote($entityName).'}', $mappedEntity); |
|
| 170 | 170 | } |
| 171 | 171 | ); |
| 172 | 172 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | $output[] = $this->formatField( |
| 225 | 225 | sprintf(' %s', $parentClass->getParent()), |
| 226 | - ($parentClass->isRootEntity() ? '(Root) ' : '') . $this->formatValue($attributes) |
|
| 226 | + ($parentClass->isRootEntity() ? '(Root) ' : '').$this->formatValue($attributes) |
|
| 227 | 227 | ); |
| 228 | 228 | } |
| 229 | 229 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | if (is_bool($value)) { |
| 251 | - return '<comment>' . ($value ? 'True' : 'False') . '</comment>'; |
|
| 251 | + return '<comment>'.($value ? 'True' : 'False').'</comment>'; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | if (empty($value)) { |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | if ($property instanceof FieldMetadata) { |
| 332 | 332 | $output = array_merge($output, $this->formatColumn($property)); |
| 333 | - } else if ($property instanceof AssociationMetadata) { |
|
| 333 | + } else if ($property instanceof AssociationMetadata) { |
|
| 334 | 334 | // @todo guilhermeblanco Fix me! We are trying to iterate through an AssociationMetadata instance |
| 335 | 335 | foreach ($property as $field => $value) { |
| 336 | 336 | $output[] = $this->formatField(sprintf(' %s', $field), $this->formatValue($value)); |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | return $this->formatField( |
| 387 | 387 | 'Entity listeners', |
| 388 | 388 | array_map( |
| 389 | - function ($entityListener) { |
|
| 389 | + function($entityListener) { |
|
| 390 | 390 | return get_class($entityListener); |
| 391 | 391 | }, |
| 392 | 392 | $entityListeners |
@@ -25,7 +25,6 @@ |
||
| 25 | 25 | use Doctrine\ORM\EntityManagerInterface; |
| 26 | 26 | use Doctrine\ORM\Event\OnFlushEventArgs; |
| 27 | 27 | use Doctrine\ORM\Mapping\AssociationMetadata; |
| 28 | -use Doctrine\ORM\Mapping\ClassMetadata; |
|
| 29 | 28 | use Doctrine\ORM\Mapping\ToOneAssociationMetadata; |
| 30 | 29 | use Doctrine\ORM\PersistentCollection; |
| 31 | 30 | use Doctrine\ORM\UnitOfWork; |
@@ -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\ORM\Tools; |
| 6 | 6 | |
@@ -76,20 +76,20 @@ discard block |
||
| 76 | 76 | fwrite($fh, "Flush Operation [".$this->context."] - Dumping identity map:\n"); |
| 77 | 77 | |
| 78 | 78 | foreach ($identityMap as $className => $map) { |
| 79 | - fwrite($fh, "Class: ". $className . "\n"); |
|
| 79 | + fwrite($fh, "Class: ".$className."\n"); |
|
| 80 | 80 | |
| 81 | 81 | foreach ($map as $entity) { |
| 82 | - fwrite($fh, " Entity: " . $this->getIdString($entity, $uow) . " " . spl_object_hash($entity)."\n"); |
|
| 82 | + fwrite($fh, " Entity: ".$this->getIdString($entity, $uow)." ".spl_object_hash($entity)."\n"); |
|
| 83 | 83 | fwrite($fh, " Associations:\n"); |
| 84 | 84 | |
| 85 | 85 | $cm = $em->getClassMetadata($className); |
| 86 | 86 | |
| 87 | 87 | foreach ($cm->getDeclaredPropertiesIterator() as $field => $association) { |
| 88 | - if (! ($association instanceof AssociationMetadata)) { |
|
| 88 | + if ( ! ($association instanceof AssociationMetadata)) { |
|
| 89 | 89 | continue; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - fwrite($fh, " " . $field . " "); |
|
| 92 | + fwrite($fh, " ".$field." "); |
|
| 93 | 93 | |
| 94 | 94 | $value = $association->getValue($entity); |
| 95 | 95 | |
@@ -100,25 +100,25 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | if ($association instanceof ToOneAssociationMetadata) { |
| 103 | - if ($value instanceof Proxy && !$value->__isInitialized()) { |
|
| 103 | + if ($value instanceof Proxy && ! $value->__isInitialized()) { |
|
| 104 | 104 | fwrite($fh, "[PROXY] "); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - fwrite($fh, $this->getIdString($value, $uow) . " " . spl_object_hash($value) . "\n"); |
|
| 107 | + fwrite($fh, $this->getIdString($value, $uow)." ".spl_object_hash($value)."\n"); |
|
| 108 | 108 | } else { |
| 109 | - $initialized = !($value instanceof PersistentCollection) || $value->isInitialized(); |
|
| 109 | + $initialized = ! ($value instanceof PersistentCollection) || $value->isInitialized(); |
|
| 110 | 110 | |
| 111 | 111 | if ($initialized) { |
| 112 | - fwrite($fh, "[INITIALIZED] " . $this->getType($value). " " . count($value) . " elements\n"); |
|
| 112 | + fwrite($fh, "[INITIALIZED] ".$this->getType($value)." ".count($value)." elements\n"); |
|
| 113 | 113 | |
| 114 | 114 | foreach ($value as $obj) { |
| 115 | - fwrite($fh, " " . $this->getIdString($obj, $uow) . " " . spl_object_hash($obj)."\n"); |
|
| 115 | + fwrite($fh, " ".$this->getIdString($obj, $uow)." ".spl_object_hash($obj)."\n"); |
|
| 116 | 116 | } |
| 117 | 117 | } else { |
| 118 | - fwrite($fh, "[PROXY] " . $this->getType($value) . " unknown element size\n"); |
|
| 118 | + fwrite($fh, "[PROXY] ".$this->getType($value)." unknown element size\n"); |
|
| 119 | 119 | |
| 120 | 120 | foreach ($value->unwrap() as $obj) { |
| 121 | - fwrite($fh, " " . $this->getIdString($obj, $uow) . " " . spl_object_hash($obj)."\n"); |
|
| 121 | + fwrite($fh, " ".$this->getIdString($obj, $uow)." ".spl_object_hash($obj)."\n"); |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -1757,7 +1757,7 @@ discard block |
||
| 1757 | 1757 | /** |
| 1758 | 1758 | * @param integer $type The inheritance type used by the class and its subclasses. |
| 1759 | 1759 | * |
| 1760 | - * @return string The literal string for the inheritance type. |
|
| 1760 | + * @return integer The literal string for the inheritance type. |
|
| 1761 | 1761 | * |
| 1762 | 1762 | * @throws \InvalidArgumentException When the inheritance type does not exist. |
| 1763 | 1763 | */ |
@@ -1773,7 +1773,7 @@ discard block |
||
| 1773 | 1773 | /** |
| 1774 | 1774 | * @param integer $type The policy used for change-tracking for the mapped class. |
| 1775 | 1775 | * |
| 1776 | - * @return string The literal string for the change-tracking type. |
|
| 1776 | + * @return integer The literal string for the change-tracking type. |
|
| 1777 | 1777 | * |
| 1778 | 1778 | * @throws \InvalidArgumentException When the change-tracking type does not exist. |
| 1779 | 1779 | */ |
@@ -1789,7 +1789,7 @@ discard block |
||
| 1789 | 1789 | /** |
| 1790 | 1790 | * @param integer $type The generator to use for the mapped class. |
| 1791 | 1791 | * |
| 1792 | - * @return string The literal string for the generator type. |
|
| 1792 | + * @return integer The literal string for the generator type. |
|
| 1793 | 1793 | * |
| 1794 | 1794 | * @throws \InvalidArgumentException When the generator type does not exist. |
| 1795 | 1795 | */ |
@@ -1343,14 +1343,14 @@ |
||
| 1343 | 1343 | } |
| 1344 | 1344 | |
| 1345 | 1345 | $replacements = [ |
| 1346 | - '<description>' => ucfirst($type) . ' ' . $variableName . '.', |
|
| 1347 | - '<methodTypeHint>' => $methodTypeHint, |
|
| 1348 | - '<variableType>' => $variableType . (null !== $defaultValue ? ('|' . $defaultValue) : ''), |
|
| 1349 | - '<variableName>' => $variableName, |
|
| 1350 | - '<methodName>' => $methodName, |
|
| 1351 | - '<fieldName>' => $fieldName, |
|
| 1352 | - '<variableDefault>' => ($defaultValue !== null ) ? (' = ' . $defaultValue) : '', |
|
| 1353 | - '<entity>' => $this->getClassName($metadata) |
|
| 1346 | + '<description>' => ucfirst($type) . ' ' . $variableName . '.', |
|
| 1347 | + '<methodTypeHint>' => $methodTypeHint, |
|
| 1348 | + '<variableType>' => $variableType . (null !== $defaultValue ? ('|' . $defaultValue) : ''), |
|
| 1349 | + '<variableName>' => $variableName, |
|
| 1350 | + '<methodName>' => $methodName, |
|
| 1351 | + '<fieldName>' => $fieldName, |
|
| 1352 | + '<variableDefault>' => ($defaultValue !== null ) ? (' = ' . $defaultValue) : '', |
|
| 1353 | + '<entity>' => $this->getClassName($metadata) |
|
| 1354 | 1354 | ]; |
| 1355 | 1355 | |
| 1356 | 1356 | $method = str_replace( |
@@ -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\ORM\Tools; |
| 6 | 6 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | public function writeEntityClass(ClassMetadata $metadata, $outputDirectory) |
| 330 | 330 | { |
| 331 | - $path = $outputDirectory . '/' . str_replace('\\', DIRECTORY_SEPARATOR, $metadata->getClassName()) . $this->extension; |
|
| 331 | + $path = $outputDirectory.'/'.str_replace('\\', DIRECTORY_SEPARATOR, $metadata->getClassName()).$this->extension; |
|
| 332 | 332 | $dir = dirname($path); |
| 333 | 333 | |
| 334 | 334 | if ( ! is_dir($dir)) { |
@@ -344,8 +344,8 @@ discard block |
||
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | if ($this->backupExisting && file_exists($path)) { |
| 347 | - $backupPath = dirname($path) . DIRECTORY_SEPARATOR . basename($path) . "~"; |
|
| 348 | - if (!copy($path, $backupPath)) { |
|
| 347 | + $backupPath = dirname($path).DIRECTORY_SEPARATOR.basename($path)."~"; |
|
| 348 | + if ( ! copy($path, $backupPath)) { |
|
| 349 | 349 | throw new \RuntimeException("Attempt to backup overwritten entity file but copy operation failed."); |
| 350 | 350 | } |
| 351 | 351 | } |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | $body = str_replace('<spaces>', $this->spaces, $body); |
| 407 | 407 | $last = strrpos($currentCode, '}'); |
| 408 | 408 | |
| 409 | - return substr($currentCode, 0, $last) . $body . ($body ? "\n" : '') . "}\n"; |
|
| 409 | + return substr($currentCode, 0, $last).$body.($body ? "\n" : '')."}\n"; |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | /** |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | public function setFieldVisibility($visibility) |
| 471 | 471 | { |
| 472 | 472 | if ($visibility !== static::FIELD_VISIBLE_PRIVATE && $visibility !== static::FIELD_VISIBLE_PROTECTED) { |
| 473 | - throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): ' . $visibility); |
|
| 473 | + throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): '.$visibility); |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | $this->fieldVisibility = $visibility; |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | protected function generateEntityNamespace(ClassMetadata $metadata) |
| 569 | 569 | { |
| 570 | 570 | if ($this->hasNamespace($metadata)) { |
| 571 | - return 'namespace ' . $this->getNamespace($metadata) .';'; |
|
| 571 | + return 'namespace '.$this->getNamespace($metadata).';'; |
|
| 572 | 572 | } |
| 573 | 573 | } |
| 574 | 574 | |
@@ -588,8 +588,8 @@ discard block |
||
| 588 | 588 | */ |
| 589 | 589 | protected function generateEntityClassName(ClassMetadata $metadata) |
| 590 | 590 | { |
| 591 | - return 'class ' . $this->getClassName($metadata) . |
|
| 592 | - ($this->extendsClass() ? ' extends ' . $this->getClassToExtendName() : null); |
|
| 591 | + return 'class '.$this->getClassName($metadata). |
|
| 592 | + ($this->extendsClass() ? ' extends '.$this->getClassToExtendName() : null); |
|
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | /** |
@@ -674,7 +674,7 @@ discard block |
||
| 674 | 674 | $optionalFields = []; |
| 675 | 675 | |
| 676 | 676 | foreach ($metadata->getDeclaredPropertiesIterator() as $property) { |
| 677 | - if (! $property->isNullable()) { |
|
| 677 | + if ( ! $property->isNullable()) { |
|
| 678 | 678 | $requiredFields[] = $property; |
| 679 | 679 | |
| 680 | 680 | continue; |
@@ -703,13 +703,13 @@ discard block |
||
| 703 | 703 | $fieldName = $property->getName(); |
| 704 | 704 | $fieldType = $property->getTypeName(); |
| 705 | 705 | $mappedType = $this->getType($fieldType); |
| 706 | - $param = '$' . $fieldName; |
|
| 706 | + $param = '$'.$fieldName; |
|
| 707 | 707 | |
| 708 | - $paramTypes[] = $mappedType . ($property->isNullable() ? '|null' : ''); |
|
| 708 | + $paramTypes[] = $mappedType.($property->isNullable() ? '|null' : ''); |
|
| 709 | 709 | $paramVariables[] = $param; |
| 710 | 710 | |
| 711 | 711 | if ($fieldType === 'datetime') { |
| 712 | - $param = $mappedType . ' ' . $param; |
|
| 712 | + $param = $mappedType.' '.$param; |
|
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | if ($property->isNullable()) { |
@@ -718,13 +718,13 @@ discard block |
||
| 718 | 718 | |
| 719 | 719 | $params[] = $param; |
| 720 | 720 | |
| 721 | - $fields[] = '$this->' . $fieldName . ' = $' . $fieldName . ';'; |
|
| 721 | + $fields[] = '$this->'.$fieldName.' = $'.$fieldName.';'; |
|
| 722 | 722 | } |
| 723 | 723 | |
| 724 | 724 | $maxParamTypeLength = max(array_map('strlen', $paramTypes)); |
| 725 | 725 | $paramTags = array_map( |
| 726 | - function ($type, $variable) use ($maxParamTypeLength) { |
|
| 727 | - return '@param ' . $type . str_repeat(' ', $maxParamTypeLength - strlen($type) + 1) . $variable; |
|
| 726 | + function($type, $variable) use ($maxParamTypeLength) { |
|
| 727 | + return '@param '.$type.str_repeat(' ', $maxParamTypeLength - strlen($type) + 1).$variable; |
|
| 728 | 728 | }, |
| 729 | 729 | $paramTypes, |
| 730 | 730 | $paramVariables |
@@ -732,8 +732,8 @@ discard block |
||
| 732 | 732 | |
| 733 | 733 | // Generate multi line constructor if the signature exceeds 120 characters. |
| 734 | 734 | if (array_sum(array_map('strlen', $params)) + count($params) * 2 + 29 > 120) { |
| 735 | - $delimiter = "\n" . $this->spaces; |
|
| 736 | - $params = $delimiter . implode(',' . $delimiter, $params) . "\n"; |
|
| 735 | + $delimiter = "\n".$this->spaces; |
|
| 736 | + $params = $delimiter.implode(','.$delimiter, $params)."\n"; |
|
| 737 | 737 | } else { |
| 738 | 738 | $params = implode(', ', $params); |
| 739 | 739 | } |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | $replacements = [ |
| 742 | 742 | '<paramTags>' => implode("\n * ", $paramTags), |
| 743 | 743 | '<params>' => $params, |
| 744 | - '<fields>' => implode("\n" . $this->spaces, $fields), |
|
| 744 | + '<fields>' => implode("\n".$this->spaces, $fields), |
|
| 745 | 745 | ]; |
| 746 | 746 | |
| 747 | 747 | $constructor = str_replace( |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | |
| 787 | 787 | if ($inClass) { |
| 788 | 788 | $inClass = false; |
| 789 | - $lastSeenClass = $lastSeenNamespace . ($lastSeenNamespace ? '\\' : '') . $token[1]; |
|
| 789 | + $lastSeenClass = $lastSeenNamespace.($lastSeenNamespace ? '\\' : '').$token[1]; |
|
| 790 | 790 | $this->staticReflection[$lastSeenClass]['properties'] = []; |
| 791 | 791 | $this->staticReflection[$lastSeenClass]['methods'] = []; |
| 792 | 792 | } |
@@ -794,16 +794,16 @@ discard block |
||
| 794 | 794 | if (T_NAMESPACE === $token[0]) { |
| 795 | 795 | $lastSeenNamespace = ''; |
| 796 | 796 | $inNamespace = true; |
| 797 | - } elseif (T_CLASS === $token[0] && T_DOUBLE_COLON !== $tokens[$i-1][0]) { |
|
| 797 | + } elseif (T_CLASS === $token[0] && T_DOUBLE_COLON !== $tokens[$i - 1][0]) { |
|
| 798 | 798 | $inClass = true; |
| 799 | 799 | } elseif (T_FUNCTION === $token[0]) { |
| 800 | - if (T_STRING === $tokens[$i+2][0]) { |
|
| 801 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+2][1]); |
|
| 802 | - } elseif ($tokens[$i+2] == '&' && T_STRING === $tokens[$i+3][0]) { |
|
| 803 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+3][1]); |
|
| 800 | + if (T_STRING === $tokens[$i + 2][0]) { |
|
| 801 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 2][1]); |
|
| 802 | + } elseif ($tokens[$i + 2] == '&' && T_STRING === $tokens[$i + 3][0]) { |
|
| 803 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 3][1]); |
|
| 804 | 804 | } |
| 805 | - } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED], true) && T_FUNCTION !== $tokens[$i+2][0]) { |
|
| 806 | - $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i+2][1], 1); |
|
| 805 | + } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED], true) && T_FUNCTION !== $tokens[$i + 2][0]) { |
|
| 806 | + $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i + 2][1], 1); |
|
| 807 | 807 | } |
| 808 | 808 | } |
| 809 | 809 | } |
@@ -816,7 +816,7 @@ discard block |
||
| 816 | 816 | */ |
| 817 | 817 | protected function hasProperty($property, ClassMetadata $metadata) |
| 818 | 818 | { |
| 819 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->getClassName()))) { |
|
| 819 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->getClassName()))) { |
|
| 820 | 820 | // don't generate property if its already on the base class. |
| 821 | 821 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->getClassName()); |
| 822 | 822 | |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | */ |
| 847 | 847 | protected function hasMethod($method, ClassMetadata $metadata) |
| 848 | 848 | { |
| 849 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->getClassName()))) { |
|
| 849 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->getClassName()))) { |
|
| 850 | 850 | // don't generate method if its already on the base class. |
| 851 | 851 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->getClassName()); |
| 852 | 852 | |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | */ |
| 876 | 876 | protected function getTraits(ClassMetadata $metadata) |
| 877 | 877 | { |
| 878 | - if (! ($metadata->getReflectionClass() !== null || class_exists($metadata->getClassName()))) { |
|
| 878 | + if ( ! ($metadata->getReflectionClass() !== null || class_exists($metadata->getClassName()))) { |
|
| 879 | 879 | return []; |
| 880 | 880 | } |
| 881 | 881 | |
@@ -924,7 +924,7 @@ discard block |
||
| 924 | 924 | { |
| 925 | 925 | $refl = new \ReflectionClass($this->getClassToExtend()); |
| 926 | 926 | |
| 927 | - return '\\' . $refl->getName(); |
|
| 927 | + return '\\'.$refl->getName(); |
|
| 928 | 928 | } |
| 929 | 929 | |
| 930 | 930 | /** |
@@ -957,7 +957,7 @@ discard block |
||
| 957 | 957 | { |
| 958 | 958 | $lines = []; |
| 959 | 959 | $lines[] = '/**'; |
| 960 | - $lines[] = ' * ' . $this->getClassName($metadata); |
|
| 960 | + $lines[] = ' * '.$this->getClassName($metadata); |
|
| 961 | 961 | |
| 962 | 962 | if ($this->generateAnnotations) { |
| 963 | 963 | $lines[] = ' *'; |
@@ -972,12 +972,12 @@ discard block |
||
| 972 | 972 | |
| 973 | 973 | foreach ($methods as $method) { |
| 974 | 974 | if ($code = $this->$method($metadata)) { |
| 975 | - $lines[] = ' * ' . $code; |
|
| 975 | + $lines[] = ' * '.$code; |
|
| 976 | 976 | } |
| 977 | 977 | } |
| 978 | 978 | |
| 979 | 979 | if (isset($metadata->lifecycleCallbacks) && $metadata->lifecycleCallbacks) { |
| 980 | - $lines[] = ' * @' . $this->annotationsPrefix . 'HasLifecycleCallbacks'; |
|
| 980 | + $lines[] = ' * @'.$this->annotationsPrefix.'HasLifecycleCallbacks'; |
|
| 981 | 981 | } |
| 982 | 982 | } |
| 983 | 983 | |
@@ -993,17 +993,17 @@ discard block |
||
| 993 | 993 | */ |
| 994 | 994 | protected function generateEntityAnnotation(ClassMetadata $metadata) |
| 995 | 995 | { |
| 996 | - $prefix = '@' . $this->annotationsPrefix; |
|
| 996 | + $prefix = '@'.$this->annotationsPrefix; |
|
| 997 | 997 | |
| 998 | 998 | if ($metadata->isEmbeddedClass) { |
| 999 | - return $prefix . 'Embeddable'; |
|
| 999 | + return $prefix.'Embeddable'; |
|
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | 1002 | $customRepository = $metadata->getCustomRepositoryClassName() |
| 1003 | - ? '(repositoryClass="' . $metadata->getCustomRepositoryClassName() . '")' |
|
| 1003 | + ? '(repositoryClass="'.$metadata->getCustomRepositoryClassName().'")' |
|
| 1004 | 1004 | : ''; |
| 1005 | 1005 | |
| 1006 | - return $prefix . ($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity') . $customRepository; |
|
| 1006 | + return $prefix.($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity').$customRepository; |
|
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | 1009 | /** |
@@ -1020,28 +1020,28 @@ discard block |
||
| 1020 | 1020 | $table = []; |
| 1021 | 1021 | |
| 1022 | 1022 | if ($metadata->table->getSchema()) { |
| 1023 | - $table[] = 'schema="' . $metadata->table->getSchema() . '"'; |
|
| 1023 | + $table[] = 'schema="'.$metadata->table->getSchema().'"'; |
|
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | 1026 | if ($metadata->table->getName()) { |
| 1027 | - $table[] = 'name="' . $metadata->table->getName() . '"'; |
|
| 1027 | + $table[] = 'name="'.$metadata->table->getName().'"'; |
|
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | 1030 | if ($metadata->table->getOptions()) { |
| 1031 | - $table[] = 'options={' . $this->exportTableOptions($metadata->table->getOptions()) . '}'; |
|
| 1031 | + $table[] = 'options={'.$this->exportTableOptions($metadata->table->getOptions()).'}'; |
|
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | if ($metadata->table->getUniqueConstraints()) { |
| 1035 | 1035 | $constraints = $this->generateTableConstraints('UniqueConstraint', $metadata->table->getUniqueConstraints()); |
| 1036 | - $table[] = 'uniqueConstraints={' . $constraints . '}'; |
|
| 1036 | + $table[] = 'uniqueConstraints={'.$constraints.'}'; |
|
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | 1039 | if ($metadata->table->getIndexes()) { |
| 1040 | 1040 | $constraints = $this->generateTableConstraints('Index', $metadata->table->getIndexes()); |
| 1041 | - $table[] = 'indexes={' . $constraints . '}'; |
|
| 1041 | + $table[] = 'indexes={'.$constraints.'}'; |
|
| 1042 | 1042 | } |
| 1043 | 1043 | |
| 1044 | - return '@' . $this->annotationsPrefix . 'Table(' . implode(', ', $table) . ')'; |
|
| 1044 | + return '@'.$this->annotationsPrefix.'Table('.implode(', ', $table).')'; |
|
| 1045 | 1045 | } |
| 1046 | 1046 | |
| 1047 | 1047 | /** |
@@ -1058,10 +1058,10 @@ discard block |
||
| 1058 | 1058 | $columns = []; |
| 1059 | 1059 | |
| 1060 | 1060 | foreach ($constraint['columns'] as $column) { |
| 1061 | - $columns[] = '"' . $column . '"'; |
|
| 1061 | + $columns[] = '"'.$column.'"'; |
|
| 1062 | 1062 | } |
| 1063 | 1063 | |
| 1064 | - $annotations[] = '@' . $this->annotationsPrefix . $constraintName . '(name="' . $name . '", columns={' . implode(', ', $columns) . '})'; |
|
| 1064 | + $annotations[] = '@'.$this->annotationsPrefix.$constraintName.'(name="'.$name.'", columns={'.implode(', ', $columns).'})'; |
|
| 1065 | 1065 | } |
| 1066 | 1066 | |
| 1067 | 1067 | return implode(', ', $annotations); |
@@ -1075,7 +1075,7 @@ discard block |
||
| 1075 | 1075 | protected function generateInheritanceAnnotation(ClassMetadata $metadata) |
| 1076 | 1076 | { |
| 1077 | 1077 | if ($metadata->inheritanceType !== InheritanceType::NONE) { |
| 1078 | - return '@' . $this->annotationsPrefix . 'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
| 1078 | + return '@'.$this->annotationsPrefix.'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
| 1079 | 1079 | } |
| 1080 | 1080 | } |
| 1081 | 1081 | |
@@ -1096,7 +1096,7 @@ discard block |
||
| 1096 | 1096 | $discrColumn->getLength() |
| 1097 | 1097 | ); |
| 1098 | 1098 | |
| 1099 | - return '@' . $this->annotationsPrefix . 'DiscriminatorColumn(' . $columnDefinition . ')'; |
|
| 1099 | + return '@'.$this->annotationsPrefix.'DiscriminatorColumn('.$columnDefinition.')'; |
|
| 1100 | 1100 | } |
| 1101 | 1101 | } |
| 1102 | 1102 | |
@@ -1111,10 +1111,10 @@ discard block |
||
| 1111 | 1111 | $inheritanceClassMap = []; |
| 1112 | 1112 | |
| 1113 | 1113 | foreach ($metadata->discriminatorMap as $type => $class) { |
| 1114 | - $inheritanceClassMap[] .= '"' . $type . '" = "' . $class . '"'; |
|
| 1114 | + $inheritanceClassMap[] .= '"'.$type.'" = "'.$class.'"'; |
|
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | - return '@' . $this->annotationsPrefix . 'DiscriminatorMap({' . implode(', ', $inheritanceClassMap) . '})'; |
|
| 1117 | + return '@'.$this->annotationsPrefix.'DiscriminatorMap({'.implode(', ', $inheritanceClassMap).'})'; |
|
| 1118 | 1118 | } |
| 1119 | 1119 | } |
| 1120 | 1120 | |
@@ -1145,7 +1145,7 @@ discard block |
||
| 1145 | 1145 | |
| 1146 | 1146 | foreach ($metadata->getDeclaredPropertiesIterator() as $fieldName => $property) { |
| 1147 | 1147 | if ($property instanceof FieldMetadata) { |
| 1148 | - $nullable = $property->isNullable() ? 'null' : null; |
|
| 1148 | + $nullable = $property->isNullable() ? 'null' : null; |
|
| 1149 | 1149 | |
| 1150 | 1150 | if ($code = $this->generateEntityStubMethod($metadata, 'get', $fieldName, $property->getTypeName(), $nullable)) { |
| 1151 | 1151 | $methods[] = $code; |
@@ -1201,7 +1201,7 @@ discard block |
||
| 1201 | 1201 | ; |
| 1202 | 1202 | |
| 1203 | 1203 | foreach ($joinColumns as $joinColumn) { |
| 1204 | - if (! $joinColumn->isNullable()) { |
|
| 1204 | + if ( ! $joinColumn->isNullable()) { |
|
| 1205 | 1205 | return false; |
| 1206 | 1206 | } |
| 1207 | 1207 | } |
@@ -1253,7 +1253,7 @@ discard block |
||
| 1253 | 1253 | |
| 1254 | 1254 | if ($property instanceof FieldMetadata) { |
| 1255 | 1255 | $options = $property->getOptions(); |
| 1256 | - $defaultValue = isset($options['default']) ? ' = ' . var_export($options['default'], true) : null; |
|
| 1256 | + $defaultValue = isset($options['default']) ? ' = '.var_export($options['default'], true) : null; |
|
| 1257 | 1257 | |
| 1258 | 1258 | $lines[] = $this->generateFieldMappingPropertyDocBlock($property, $metadata); |
| 1259 | 1259 | } else { |
@@ -1262,7 +1262,7 @@ discard block |
||
| 1262 | 1262 | $lines[] = $this->generateAssociationMappingPropertyDocBlock($property, $metadata); |
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldName . $defaultValue . ";\n"; |
|
| 1265 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$fieldName.$defaultValue.";\n"; |
|
| 1266 | 1266 | } |
| 1267 | 1267 | |
| 1268 | 1268 | return implode("\n", $lines); |
@@ -1300,7 +1300,7 @@ discard block |
||
| 1300 | 1300 | */ |
| 1301 | 1301 | protected function generateEntityStubMethod(ClassMetadata $metadata, $type, $fieldName, $typeHint = null, $defaultValue = null) |
| 1302 | 1302 | { |
| 1303 | - $methodName = $type . Inflector::classify($fieldName); |
|
| 1303 | + $methodName = $type.Inflector::classify($fieldName); |
|
| 1304 | 1304 | $variableName = Inflector::camelize($fieldName); |
| 1305 | 1305 | |
| 1306 | 1306 | if (in_array($type, ["add", "remove"])) { |
@@ -1321,18 +1321,18 @@ discard block |
||
| 1321 | 1321 | $variableType = $typeHint ? $this->getType($typeHint) : null; |
| 1322 | 1322 | |
| 1323 | 1323 | if ($typeHint && ! isset($types[$typeHint])) { |
| 1324 | - $variableType = '\\' . ltrim($variableType, '\\'); |
|
| 1325 | - $methodTypeHint = '\\' . $typeHint . ' '; |
|
| 1324 | + $variableType = '\\'.ltrim($variableType, '\\'); |
|
| 1325 | + $methodTypeHint = '\\'.$typeHint.' '; |
|
| 1326 | 1326 | } |
| 1327 | 1327 | |
| 1328 | 1328 | $replacements = [ |
| 1329 | - '<description>' => ucfirst($type) . ' ' . $variableName . '.', |
|
| 1329 | + '<description>' => ucfirst($type).' '.$variableName.'.', |
|
| 1330 | 1330 | '<methodTypeHint>' => $methodTypeHint, |
| 1331 | - '<variableType>' => $variableType . (null !== $defaultValue ? ('|' . $defaultValue) : ''), |
|
| 1331 | + '<variableType>' => $variableType.(null !== $defaultValue ? ('|'.$defaultValue) : ''), |
|
| 1332 | 1332 | '<variableName>' => $variableName, |
| 1333 | 1333 | '<methodName>' => $methodName, |
| 1334 | 1334 | '<fieldName>' => $fieldName, |
| 1335 | - '<variableDefault>' => ($defaultValue !== null ) ? (' = ' . $defaultValue) : '', |
|
| 1335 | + '<variableDefault>' => ($defaultValue !== null) ? (' = '.$defaultValue) : '', |
|
| 1336 | 1336 | '<entity>' => $this->getClassName($metadata) |
| 1337 | 1337 | ]; |
| 1338 | 1338 | |
@@ -1360,7 +1360,7 @@ discard block |
||
| 1360 | 1360 | $this->staticReflection[$metadata->getClassName()]['methods'][] = $methodName; |
| 1361 | 1361 | |
| 1362 | 1362 | $replacements = [ |
| 1363 | - '<name>' => $this->annotationsPrefix . ucfirst($name), |
|
| 1363 | + '<name>' => $this->annotationsPrefix.ucfirst($name), |
|
| 1364 | 1364 | '<methodName>' => $methodName, |
| 1365 | 1365 | ]; |
| 1366 | 1366 | |
@@ -1380,25 +1380,25 @@ discard block |
||
| 1380 | 1380 | */ |
| 1381 | 1381 | protected function generateIdentifierAnnotation(Property $metadata) |
| 1382 | 1382 | { |
| 1383 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Id'; |
|
| 1383 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Id'; |
|
| 1384 | 1384 | |
| 1385 | 1385 | if ($metadata instanceof FieldMetadata) { |
| 1386 | 1386 | if ($generatorType = $this->getIdGeneratorTypeString($metadata->getValueGenerator()->getType())) { |
| 1387 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; |
|
| 1387 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'GeneratedValue(strategy="'.$generatorType.'")'; |
|
| 1388 | 1388 | } |
| 1389 | 1389 | |
| 1390 | 1390 | if ($metadata->getValueGenerator()->getType()) { |
| 1391 | 1391 | $generator = []; |
| 1392 | 1392 | |
| 1393 | 1393 | if (isset($metadata->getValueGenerator()->getDefinition()['sequenceName'])) { |
| 1394 | - $generator[] = 'sequenceName="' . $metadata->getValueGenerator()->getDefinition()['sequenceName'] . '"'; |
|
| 1394 | + $generator[] = 'sequenceName="'.$metadata->getValueGenerator()->getDefinition()['sequenceName'].'"'; |
|
| 1395 | 1395 | } |
| 1396 | 1396 | |
| 1397 | 1397 | if (isset($metadata->getValueGenerator()->getDefinition()['allocationSize'])) { |
| 1398 | - $generator[] = 'allocationSize=' . $metadata->getValueGenerator()->getDefinition()['allocationSize']; |
|
| 1398 | + $generator[] = 'allocationSize='.$metadata->getValueGenerator()->getDefinition()['allocationSize']; |
|
| 1399 | 1399 | } |
| 1400 | 1400 | |
| 1401 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'SequenceGenerator(' . implode(', ', $generator) . ')'; |
|
| 1401 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'SequenceGenerator('.implode(', ', $generator).')'; |
|
| 1402 | 1402 | } |
| 1403 | 1403 | } |
| 1404 | 1404 | |
@@ -1414,34 +1414,34 @@ discard block |
||
| 1414 | 1414 | { |
| 1415 | 1415 | $lines = []; |
| 1416 | 1416 | $joinTableAnnot = []; |
| 1417 | - $joinTableAnnot[] = 'name="' . $joinTable->getName() . '"'; |
|
| 1417 | + $joinTableAnnot[] = 'name="'.$joinTable->getName().'"'; |
|
| 1418 | 1418 | |
| 1419 | - if (! empty($joinTable->getSchema())) { |
|
| 1420 | - $joinTableAnnot[] = 'schema="' . $joinTable->getSchema() . '"'; |
|
| 1419 | + if ( ! empty($joinTable->getSchema())) { |
|
| 1420 | + $joinTableAnnot[] = 'schema="'.$joinTable->getSchema().'"'; |
|
| 1421 | 1421 | } |
| 1422 | 1422 | |
| 1423 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinTable(' . implode(', ', $joinTableAnnot) . ','; |
|
| 1424 | - $lines[] = $this->spaces . ' * joinColumns={'; |
|
| 1423 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinTable('.implode(', ', $joinTableAnnot).','; |
|
| 1424 | + $lines[] = $this->spaces.' * joinColumns={'; |
|
| 1425 | 1425 | |
| 1426 | 1426 | $joinColumnsLines = []; |
| 1427 | 1427 | |
| 1428 | 1428 | foreach ($joinTable->getJoinColumns() as $joinColumn) { |
| 1429 | - $joinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
| 1429 | + $joinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
| 1430 | 1430 | } |
| 1431 | 1431 | |
| 1432 | - $lines[] = implode(",". PHP_EOL, $joinColumnsLines); |
|
| 1433 | - $lines[] = $this->spaces . ' * },'; |
|
| 1434 | - $lines[] = $this->spaces . ' * inverseJoinColumns={'; |
|
| 1432 | + $lines[] = implode(",".PHP_EOL, $joinColumnsLines); |
|
| 1433 | + $lines[] = $this->spaces.' * },'; |
|
| 1434 | + $lines[] = $this->spaces.' * inverseJoinColumns={'; |
|
| 1435 | 1435 | |
| 1436 | 1436 | $inverseJoinColumnsLines = []; |
| 1437 | 1437 | |
| 1438 | 1438 | foreach ($joinTable->getInverseJoinColumns() as $joinColumn) { |
| 1439 | - $inverseJoinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
| 1439 | + $inverseJoinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
| 1440 | 1440 | } |
| 1441 | 1441 | |
| 1442 | - $lines[] = implode(",". PHP_EOL, $inverseJoinColumnsLines); |
|
| 1443 | - $lines[] = $this->spaces . ' * }'; |
|
| 1444 | - $lines[] = $this->spaces . ' * )'; |
|
| 1442 | + $lines[] = implode(",".PHP_EOL, $inverseJoinColumnsLines); |
|
| 1443 | + $lines[] = $this->spaces.' * }'; |
|
| 1444 | + $lines[] = $this->spaces.' * )'; |
|
| 1445 | 1445 | |
| 1446 | 1446 | return implode(PHP_EOL, $lines); |
| 1447 | 1447 | } |
@@ -1455,23 +1455,23 @@ discard block |
||
| 1455 | 1455 | { |
| 1456 | 1456 | $joinColumnAnnot = []; |
| 1457 | 1457 | |
| 1458 | - $joinColumnAnnot[] = 'name="' . $joinColumn->getColumnName() . '"'; |
|
| 1459 | - $joinColumnAnnot[] = 'referencedColumnName="' . $joinColumn->getReferencedColumnName() . '"'; |
|
| 1458 | + $joinColumnAnnot[] = 'name="'.$joinColumn->getColumnName().'"'; |
|
| 1459 | + $joinColumnAnnot[] = 'referencedColumnName="'.$joinColumn->getReferencedColumnName().'"'; |
|
| 1460 | 1460 | |
| 1461 | 1461 | if ($joinColumn->isUnique()) { |
| 1462 | 1462 | $joinColumnAnnot[] = 'unique=true'; |
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | - if (!$joinColumn->isNullable()) { |
|
| 1465 | + if ( ! $joinColumn->isNullable()) { |
|
| 1466 | 1466 | $joinColumnAnnot[] = 'nullable=false'; |
| 1467 | 1467 | } |
| 1468 | 1468 | |
| 1469 | - if (!empty($joinColumn->getOnDelete())) { |
|
| 1470 | - $joinColumnAnnot[] = 'onDelete="' . $joinColumn->getOnDelete() . '"'; |
|
| 1469 | + if ( ! empty($joinColumn->getOnDelete())) { |
|
| 1470 | + $joinColumnAnnot[] = 'onDelete="'.$joinColumn->getOnDelete().'"'; |
|
| 1471 | 1471 | } |
| 1472 | 1472 | |
| 1473 | 1473 | if ($joinColumn->getColumnDefinition()) { |
| 1474 | - $joinColumnAnnot[] = 'columnDefinition="' . $joinColumn->getColumnDefinition() . '"'; |
|
| 1474 | + $joinColumnAnnot[] = 'columnDefinition="'.$joinColumn->getColumnDefinition().'"'; |
|
| 1475 | 1475 | } |
| 1476 | 1476 | |
| 1477 | 1477 | $options = []; |
@@ -1486,7 +1486,7 @@ discard block |
||
| 1486 | 1486 | $joinColumnAnnot[] = 'options={'.implode(',', $options).'}'; |
| 1487 | 1487 | } |
| 1488 | 1488 | |
| 1489 | - return '@' . $this->annotationsPrefix . 'JoinColumn(' . implode(', ', $joinColumnAnnot) . ')'; |
|
| 1489 | + return '@'.$this->annotationsPrefix.'JoinColumn('.implode(', ', $joinColumnAnnot).')'; |
|
| 1490 | 1490 | } |
| 1491 | 1491 | |
| 1492 | 1492 | /** |
@@ -1498,16 +1498,16 @@ discard block |
||
| 1498 | 1498 | protected function generateAssociationMappingPropertyDocBlock(AssociationMetadata $association, ClassMetadata $metadata) |
| 1499 | 1499 | { |
| 1500 | 1500 | $lines = []; |
| 1501 | - $lines[] = $this->spaces . '/**'; |
|
| 1501 | + $lines[] = $this->spaces.'/**'; |
|
| 1502 | 1502 | |
| 1503 | 1503 | if ($association instanceof ToManyAssociationMetadata) { |
| 1504 | - $lines[] = $this->spaces . ' * @var \Doctrine\Common\Collections\Collection'; |
|
| 1504 | + $lines[] = $this->spaces.' * @var \Doctrine\Common\Collections\Collection'; |
|
| 1505 | 1505 | } else { |
| 1506 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($association->getTargetEntity(), '\\'); |
|
| 1506 | + $lines[] = $this->spaces.' * @var \\'.ltrim($association->getTargetEntity(), '\\'); |
|
| 1507 | 1507 | } |
| 1508 | 1508 | |
| 1509 | 1509 | if ($this->generateAnnotations) { |
| 1510 | - $lines[] = $this->spaces . ' *'; |
|
| 1510 | + $lines[] = $this->spaces.' *'; |
|
| 1511 | 1511 | |
| 1512 | 1512 | if ($association->isPrimaryKey()) { |
| 1513 | 1513 | $lines[] = $this->generateIdentifierAnnotation($association); |
@@ -1527,18 +1527,18 @@ discard block |
||
| 1527 | 1527 | |
| 1528 | 1528 | $typeOptions = []; |
| 1529 | 1529 | |
| 1530 | - $typeOptions[] = 'targetEntity="' . $association->getTargetEntity() . '"'; |
|
| 1530 | + $typeOptions[] = 'targetEntity="'.$association->getTargetEntity().'"'; |
|
| 1531 | 1531 | |
| 1532 | 1532 | if ($association->getMappedBy()) { |
| 1533 | - $typeOptions[] = 'mappedBy="' . $association->getMappedBy() . '"'; |
|
| 1533 | + $typeOptions[] = 'mappedBy="'.$association->getMappedBy().'"'; |
|
| 1534 | 1534 | } |
| 1535 | 1535 | |
| 1536 | 1536 | if ($association->getInversedBy()) { |
| 1537 | - $typeOptions[] = 'inversedBy="' . $association->getInversedBy() . '"'; |
|
| 1537 | + $typeOptions[] = 'inversedBy="'.$association->getInversedBy().'"'; |
|
| 1538 | 1538 | } |
| 1539 | 1539 | |
| 1540 | 1540 | if ($association instanceof ToManyAssociationMetadata && $association->getIndexedBy()) { |
| 1541 | - $typeOptions[] = 'indexBy="' . $association->getIndexedBy() . '"'; |
|
| 1541 | + $typeOptions[] = 'indexBy="'.$association->getIndexedBy().'"'; |
|
| 1542 | 1542 | } |
| 1543 | 1543 | |
| 1544 | 1544 | if ($association->isOrphanRemoval()) { |
@@ -1558,28 +1558,28 @@ discard block |
||
| 1558 | 1558 | $cascades = ['"all"']; |
| 1559 | 1559 | } |
| 1560 | 1560 | |
| 1561 | - $typeOptions[] = 'cascade={' . implode(',', $cascades) . '}'; |
|
| 1561 | + $typeOptions[] = 'cascade={'.implode(',', $cascades).'}'; |
|
| 1562 | 1562 | } |
| 1563 | 1563 | |
| 1564 | 1564 | if ($association->getFetchMode() !== FetchMode::LAZY) { |
| 1565 | - $typeOptions[] = 'fetch="' . $association->getFetchMode() . '"'; |
|
| 1565 | + $typeOptions[] = 'fetch="'.$association->getFetchMode().'"'; |
|
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . '' . $type . '(' . implode(', ', $typeOptions) . ')'; |
|
| 1568 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.''.$type.'('.implode(', ', $typeOptions).')'; |
|
| 1569 | 1569 | |
| 1570 | 1570 | if ($association instanceof ToOneAssociationMetadata && $association->getJoinColumns()) { |
| 1571 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinColumns({'; |
|
| 1571 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinColumns({'; |
|
| 1572 | 1572 | |
| 1573 | 1573 | $joinColumnsLines = []; |
| 1574 | 1574 | |
| 1575 | 1575 | foreach ($association->getJoinColumns() as $joinColumn) { |
| 1576 | 1576 | if ($joinColumnAnnot = $this->generateJoinColumnAnnotation($joinColumn)) { |
| 1577 | - $joinColumnsLines[] = $this->spaces . ' * ' . $joinColumnAnnot; |
|
| 1577 | + $joinColumnsLines[] = $this->spaces.' * '.$joinColumnAnnot; |
|
| 1578 | 1578 | } |
| 1579 | 1579 | } |
| 1580 | 1580 | |
| 1581 | 1581 | $lines[] = implode(",\n", $joinColumnsLines); |
| 1582 | - $lines[] = $this->spaces . ' * })'; |
|
| 1582 | + $lines[] = $this->spaces.' * })'; |
|
| 1583 | 1583 | } |
| 1584 | 1584 | |
| 1585 | 1585 | if ($association instanceof ToManyAssociationMetadata) { |
@@ -1588,20 +1588,20 @@ discard block |
||
| 1588 | 1588 | } |
| 1589 | 1589 | |
| 1590 | 1590 | if ($association->getOrderBy()) { |
| 1591 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'OrderBy({'; |
|
| 1591 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'OrderBy({'; |
|
| 1592 | 1592 | $orderBy = []; |
| 1593 | 1593 | |
| 1594 | 1594 | foreach ($association->getOrderBy() as $name => $direction) { |
| 1595 | - $orderBy[] = $this->spaces . ' * "' . $name . '"="' . $direction . '"'; |
|
| 1595 | + $orderBy[] = $this->spaces.' * "'.$name.'"="'.$direction.'"'; |
|
| 1596 | 1596 | } |
| 1597 | 1597 | |
| 1598 | - $lines[] = implode(',' . PHP_EOL, $orderBy); |
|
| 1599 | - $lines[] = $this->spaces . ' * })'; |
|
| 1598 | + $lines[] = implode(','.PHP_EOL, $orderBy); |
|
| 1599 | + $lines[] = $this->spaces.' * })'; |
|
| 1600 | 1600 | } |
| 1601 | 1601 | } |
| 1602 | 1602 | } |
| 1603 | 1603 | |
| 1604 | - $lines[] = $this->spaces . ' */'; |
|
| 1604 | + $lines[] = $this->spaces.' */'; |
|
| 1605 | 1605 | |
| 1606 | 1606 | return implode("\n", $lines); |
| 1607 | 1607 | } |
@@ -1618,43 +1618,43 @@ discard block |
||
| 1618 | 1618 | |
| 1619 | 1619 | $lines = []; |
| 1620 | 1620 | |
| 1621 | - $lines[] = $this->spaces . '/**'; |
|
| 1622 | - $lines[] = $this->spaces . ' * @var ' |
|
| 1621 | + $lines[] = $this->spaces.'/**'; |
|
| 1622 | + $lines[] = $this->spaces.' * @var ' |
|
| 1623 | 1623 | . $this->getType($fieldType) |
| 1624 | 1624 | . ($propertyMetadata->isNullable() ? '|null' : ''); |
| 1625 | 1625 | |
| 1626 | 1626 | if ($this->generateAnnotations) { |
| 1627 | 1627 | $column = []; |
| 1628 | - $lines[] = $this->spaces . ' *'; |
|
| 1628 | + $lines[] = $this->spaces.' *'; |
|
| 1629 | 1629 | |
| 1630 | 1630 | if ($propertyMetadata->getColumnName()) { |
| 1631 | - $column[] = 'name="' . $propertyMetadata->getColumnName() . '"'; |
|
| 1631 | + $column[] = 'name="'.$propertyMetadata->getColumnName().'"'; |
|
| 1632 | 1632 | } |
| 1633 | 1633 | |
| 1634 | - $column[] = 'type="' . $fieldType . '"'; |
|
| 1634 | + $column[] = 'type="'.$fieldType.'"'; |
|
| 1635 | 1635 | |
| 1636 | 1636 | if (is_int($propertyMetadata->getLength())) { |
| 1637 | - $column[] = 'length=' . $propertyMetadata->getLength(); |
|
| 1637 | + $column[] = 'length='.$propertyMetadata->getLength(); |
|
| 1638 | 1638 | } |
| 1639 | 1639 | |
| 1640 | 1640 | if (is_int($propertyMetadata->getPrecision())) { |
| 1641 | - $column[] = 'precision=' . $propertyMetadata->getPrecision(); |
|
| 1641 | + $column[] = 'precision='.$propertyMetadata->getPrecision(); |
|
| 1642 | 1642 | } |
| 1643 | 1643 | |
| 1644 | 1644 | if (is_int($propertyMetadata->getScale())) { |
| 1645 | - $column[] = 'scale=' . $propertyMetadata->getScale(); |
|
| 1645 | + $column[] = 'scale='.$propertyMetadata->getScale(); |
|
| 1646 | 1646 | } |
| 1647 | 1647 | |
| 1648 | 1648 | if ($propertyMetadata->isNullable()) { |
| 1649 | - $column[] = 'nullable=' . var_export($propertyMetadata->isNullable(), true); |
|
| 1649 | + $column[] = 'nullable='.var_export($propertyMetadata->isNullable(), true); |
|
| 1650 | 1650 | } |
| 1651 | 1651 | |
| 1652 | 1652 | if ($propertyMetadata->isUnique()) { |
| 1653 | - $column[] = 'unique=' . var_export($propertyMetadata->isUnique(), true); |
|
| 1653 | + $column[] = 'unique='.var_export($propertyMetadata->isUnique(), true); |
|
| 1654 | 1654 | } |
| 1655 | 1655 | |
| 1656 | 1656 | if ($propertyMetadata->getColumnDefinition()) { |
| 1657 | - $column[] = 'columnDefinition="' . $propertyMetadata->getColumnDefinition() . '"'; |
|
| 1657 | + $column[] = 'columnDefinition="'.$propertyMetadata->getColumnDefinition().'"'; |
|
| 1658 | 1658 | } |
| 1659 | 1659 | |
| 1660 | 1660 | $options = []; |
@@ -1669,18 +1669,18 @@ discard block |
||
| 1669 | 1669 | $column[] = 'options={'.implode(',', $options).'}'; |
| 1670 | 1670 | } |
| 1671 | 1671 | |
| 1672 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Column(' . implode(', ', $column) . ')'; |
|
| 1672 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Column('.implode(', ', $column).')'; |
|
| 1673 | 1673 | |
| 1674 | 1674 | if ($propertyMetadata->isPrimaryKey()) { |
| 1675 | 1675 | $lines[] = $this->generateIdentifierAnnotation($propertyMetadata); |
| 1676 | 1676 | } |
| 1677 | 1677 | |
| 1678 | 1678 | if ($metadata->isVersioned() && $metadata->versionProperty->getName() === $propertyMetadata->getName()) { |
| 1679 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Version'; |
|
| 1679 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Version'; |
|
| 1680 | 1680 | } |
| 1681 | 1681 | } |
| 1682 | 1682 | |
| 1683 | - $lines[] = $this->spaces . ' */'; |
|
| 1683 | + $lines[] = $this->spaces.' */'; |
|
| 1684 | 1684 | |
| 1685 | 1685 | return implode("\n", $lines); |
| 1686 | 1686 | } |
@@ -1693,27 +1693,27 @@ discard block |
||
| 1693 | 1693 | protected function generateEmbeddedPropertyDocBlock(array $embeddedClass) |
| 1694 | 1694 | { |
| 1695 | 1695 | $lines = []; |
| 1696 | - $lines[] = $this->spaces . '/**'; |
|
| 1697 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($embeddedClass['class'], '\\'); |
|
| 1696 | + $lines[] = $this->spaces.'/**'; |
|
| 1697 | + $lines[] = $this->spaces.' * @var \\'.ltrim($embeddedClass['class'], '\\'); |
|
| 1698 | 1698 | |
| 1699 | 1699 | if ($this->generateAnnotations) { |
| 1700 | - $lines[] = $this->spaces . ' *'; |
|
| 1700 | + $lines[] = $this->spaces.' *'; |
|
| 1701 | 1701 | |
| 1702 | - $embedded = ['class="' . $embeddedClass['class'] . '"']; |
|
| 1702 | + $embedded = ['class="'.$embeddedClass['class'].'"']; |
|
| 1703 | 1703 | |
| 1704 | 1704 | if (isset($embeddedClass['columnPrefix'])) { |
| 1705 | 1705 | if (is_string($embeddedClass['columnPrefix'])) { |
| 1706 | - $embedded[] = 'columnPrefix="' . $embeddedClass['columnPrefix'] . '"'; |
|
| 1706 | + $embedded[] = 'columnPrefix="'.$embeddedClass['columnPrefix'].'"'; |
|
| 1707 | 1707 | } else { |
| 1708 | - $embedded[] = 'columnPrefix=' . var_export($embeddedClass['columnPrefix'], true); |
|
| 1708 | + $embedded[] = 'columnPrefix='.var_export($embeddedClass['columnPrefix'], true); |
|
| 1709 | 1709 | } |
| 1710 | 1710 | } |
| 1711 | 1711 | |
| 1712 | - $lines[] = $this->spaces . ' * @' . |
|
| 1713 | - $this->annotationsPrefix . 'Embedded(' . implode(', ', $embedded) . ')'; |
|
| 1712 | + $lines[] = $this->spaces.' * @'. |
|
| 1713 | + $this->annotationsPrefix.'Embedded('.implode(', ', $embedded).')'; |
|
| 1714 | 1714 | } |
| 1715 | 1715 | |
| 1716 | - $lines[] = $this->spaces . ' */'; |
|
| 1716 | + $lines[] = $this->spaces.' */'; |
|
| 1717 | 1717 | |
| 1718 | 1718 | return implode("\n", $lines); |
| 1719 | 1719 | } |
@@ -1730,7 +1730,7 @@ discard block |
||
| 1730 | 1730 | |
| 1731 | 1731 | foreach ($lines as $key => $value) { |
| 1732 | 1732 | if ( ! empty($value)) { |
| 1733 | - $lines[$key] = str_repeat($this->spaces, $num) . $lines[$key]; |
|
| 1733 | + $lines[$key] = str_repeat($this->spaces, $num).$lines[$key]; |
|
| 1734 | 1734 | } |
| 1735 | 1735 | } |
| 1736 | 1736 | |
@@ -1798,8 +1798,8 @@ discard block |
||
| 1798 | 1798 | |
| 1799 | 1799 | foreach ($options as $name => $option) { |
| 1800 | 1800 | $optionValue = is_array($option) |
| 1801 | - ? '{' . $this->exportTableOptions($option) . '}' |
|
| 1802 | - : '"' . (string) $option . '"' |
|
| 1801 | + ? '{'.$this->exportTableOptions($option).'}' |
|
| 1802 | + : '"'.(string) $option.'"' |
|
| 1803 | 1803 | ; |
| 1804 | 1804 | |
| 1805 | 1805 | $optionsStr[] = sprintf('"%s"=%s', $name, $optionValue); |
@@ -298,6 +298,9 @@ |
||
| 298 | 298 | $lines[] = '}'; |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | + /** |
|
| 302 | + * @param string $variableName |
|
| 303 | + */ |
|
| 301 | 304 | private function exportJoinColumns(array $joinColumns, array &$lines, $variableName) |
| 302 | 305 | { |
| 303 | 306 | $lines[] = '$' . $variableName . ' = array();'; |
@@ -28,7 +28,6 @@ |
||
| 28 | 28 | use Doctrine\ORM\Mapping\ManyToOneAssociationMetadata; |
| 29 | 29 | use Doctrine\ORM\Mapping\OneToManyAssociationMetadata; |
| 30 | 30 | use Doctrine\ORM\Mapping\OneToOneAssociationMetadata; |
| 31 | -use Doctrine\ORM\Mapping\ToOneAssociationMetadata; |
|
| 32 | 31 | |
| 33 | 32 | /** |
| 34 | 33 | * ClassMetadata exporter for PHP code. |
@@ -62,11 +62,11 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | if ($metadata->inheritanceType) { |
| 65 | - $lines[] = '$metadata->setInheritanceType(Mapping\InheritanceType::' . $metadata->inheritanceType . ');'; |
|
| 65 | + $lines[] = '$metadata->setInheritanceType(Mapping\InheritanceType::'.$metadata->inheritanceType.');'; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | if ($metadata->customRepositoryClassName) { |
| 69 | - $lines[] = '$metadata->customRepositoryClassName = "' . $metadata->customRepositoryClassName . '";'; |
|
| 69 | + $lines[] = '$metadata->customRepositoryClassName = "'.$metadata->customRepositoryClassName.'";'; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | if ($metadata->table) { |
@@ -75,19 +75,19 @@ discard block |
||
| 75 | 75 | $lines[] = '$table = new Mapping\TableMetadata();'; |
| 76 | 76 | $lines[] = null; |
| 77 | 77 | |
| 78 | - if (! empty($table->getSchema())) { |
|
| 79 | - $lines[] = '$table->setSchema("' . $table->getSchema() . '");'; |
|
| 78 | + if ( ! empty($table->getSchema())) { |
|
| 79 | + $lines[] = '$table->setSchema("'.$table->getSchema().'");'; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $lines[] = '$table->setName("' . $table->getName() . '");'; |
|
| 83 | - $lines[] = '$table->setOptions(' . $this->varExport($table->getOptions()) . ');'; |
|
| 82 | + $lines[] = '$table->setName("'.$table->getName().'");'; |
|
| 83 | + $lines[] = '$table->setOptions('.$this->varExport($table->getOptions()).');'; |
|
| 84 | 84 | |
| 85 | 85 | foreach ($table->getIndexes() as $index) { |
| 86 | - $lines[] = '$table->addIndex(' . $this->varExport($index) . ');'; |
|
| 86 | + $lines[] = '$table->addIndex('.$this->varExport($index).');'; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | foreach ($table->getUniqueConstraints() as $constraint) { |
| 90 | - $lines[] = '$table->addUniqueConstraint(' . $this->varExport($constraint) . ');'; |
|
| 90 | + $lines[] = '$table->addUniqueConstraint('.$this->varExport($constraint).');'; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $lines[] = null; |
@@ -99,51 +99,51 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | $lines[] = '$discrColumn = new Mapping\DiscriminatorColumnMetadata();'; |
| 101 | 101 | $lines[] = null; |
| 102 | - $lines[] = '$discrColumn->setColumnName("' . $discrColumn->getColumnName() . '");'; |
|
| 103 | - $lines[] = '$discrColumn->setType(Type::getType("' . $discrColumn->getTypeName() . '"));'; |
|
| 104 | - $lines[] = '$discrColumn->setTableName("' . $discrColumn->getTableName() . '");'; |
|
| 102 | + $lines[] = '$discrColumn->setColumnName("'.$discrColumn->getColumnName().'");'; |
|
| 103 | + $lines[] = '$discrColumn->setType(Type::getType("'.$discrColumn->getTypeName().'"));'; |
|
| 104 | + $lines[] = '$discrColumn->setTableName("'.$discrColumn->getTableName().'");'; |
|
| 105 | 105 | |
| 106 | - if (! empty($discrColumn->getColumnDefinition())) { |
|
| 107 | - $lines[] = '$property->setColumnDefinition("' . $discrColumn->getColumnDefinition() . '");'; |
|
| 106 | + if ( ! empty($discrColumn->getColumnDefinition())) { |
|
| 107 | + $lines[] = '$property->setColumnDefinition("'.$discrColumn->getColumnDefinition().'");'; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if (! empty($discrColumn->getLength())) { |
|
| 111 | - $lines[] = '$property->setLength(' . $discrColumn->getLength() . ');'; |
|
| 110 | + if ( ! empty($discrColumn->getLength())) { |
|
| 111 | + $lines[] = '$property->setLength('.$discrColumn->getLength().');'; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if (! empty($discrColumn->getScale())) { |
|
| 115 | - $lines[] = '$property->setScale(' . $discrColumn->getScale() . ');'; |
|
| 114 | + if ( ! empty($discrColumn->getScale())) { |
|
| 115 | + $lines[] = '$property->setScale('.$discrColumn->getScale().');'; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if (! empty($discrColumn->getPrecision())) { |
|
| 119 | - $lines[] = '$property->setPrecision(' . $discrColumn->getPrecision() . ');'; |
|
| 118 | + if ( ! empty($discrColumn->getPrecision())) { |
|
| 119 | + $lines[] = '$property->setPrecision('.$discrColumn->getPrecision().');'; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $lines[] = '$discrColumn->setOptions(' . $this->varExport($discrColumn->getOptions()) . ');'; |
|
| 123 | - $lines[] = '$discrColumn->setNullable(' . $this->varExport($discrColumn->isNullable()) . ');'; |
|
| 124 | - $lines[] = '$discrColumn->setUnique(' . $this->varExport($discrColumn->isUnique()) . ');'; |
|
| 122 | + $lines[] = '$discrColumn->setOptions('.$this->varExport($discrColumn->getOptions()).');'; |
|
| 123 | + $lines[] = '$discrColumn->setNullable('.$this->varExport($discrColumn->isNullable()).');'; |
|
| 124 | + $lines[] = '$discrColumn->setUnique('.$this->varExport($discrColumn->isUnique()).');'; |
|
| 125 | 125 | $lines[] = null; |
| 126 | 126 | $lines[] = '$metadata->setDiscriminatorColumn($discrColumn);'; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if ($metadata->discriminatorMap) { |
| 130 | - $lines[] = '$metadata->setDiscriminatorMap(' . $this->varExport($metadata->discriminatorMap) . ');'; |
|
| 130 | + $lines[] = '$metadata->setDiscriminatorMap('.$this->varExport($metadata->discriminatorMap).');'; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if ($metadata->changeTrackingPolicy) { |
| 134 | - $lines[] = '$metadata->setChangeTrackingPolicy(Mapping\ChangeTrackingPolicy::' . $metadata->changeTrackingPolicy . ');'; |
|
| 134 | + $lines[] = '$metadata->setChangeTrackingPolicy(Mapping\ChangeTrackingPolicy::'.$metadata->changeTrackingPolicy.');'; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if ($metadata->lifecycleCallbacks) { |
| 138 | 138 | foreach ($metadata->lifecycleCallbacks as $event => $callbacks) { |
| 139 | 139 | foreach ($callbacks as $callback) { |
| 140 | - $lines[] = '$metadata->addLifecycleCallback("' . $callback . '", "' . $event . '");'; |
|
| 140 | + $lines[] = '$metadata->addLifecycleCallback("'.$callback.'", "'.$event.'");'; |
|
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - if (! $metadata->isIdentifierComposite()) { |
|
| 146 | - $lines[] = '$metadata->setIdGeneratorType(Mapping\GeneratorType::' . $metadata->generatorType . ');'; |
|
| 145 | + if ( ! $metadata->isIdentifierComposite()) { |
|
| 146 | + $lines[] = '$metadata->setIdGeneratorType(Mapping\GeneratorType::'.$metadata->generatorType.');'; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | foreach ($metadata->getProperties() as $property) { |
@@ -166,30 +166,30 @@ discard block |
||
| 166 | 166 | ); |
| 167 | 167 | |
| 168 | 168 | $lines[] = null; |
| 169 | - $lines[] = '$property->setColumnName("' . $property->getColumnName() . '");'; |
|
| 170 | - $lines[] = '$property->setType(Type::getType("' . $property->getTypeName() . '"));'; |
|
| 171 | - $lines[] = '$property->setTableName("' . $property->getTableName() . '");'; |
|
| 169 | + $lines[] = '$property->setColumnName("'.$property->getColumnName().'");'; |
|
| 170 | + $lines[] = '$property->setType(Type::getType("'.$property->getTypeName().'"));'; |
|
| 171 | + $lines[] = '$property->setTableName("'.$property->getTableName().'");'; |
|
| 172 | 172 | |
| 173 | - if (! empty($property->getColumnDefinition())) { |
|
| 174 | - $lines[] = '$property->setColumnDefinition("' . $property->getColumnDefinition() . '");'; |
|
| 173 | + if ( ! empty($property->getColumnDefinition())) { |
|
| 174 | + $lines[] = '$property->setColumnDefinition("'.$property->getColumnDefinition().'");'; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - if (! empty($property->getLength())) { |
|
| 178 | - $lines[] = '$property->setLength(' . $property->getLength() . ');'; |
|
| 177 | + if ( ! empty($property->getLength())) { |
|
| 178 | + $lines[] = '$property->setLength('.$property->getLength().');'; |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if (! empty($property->getScale())) { |
|
| 182 | - $lines[] = '$property->setScale(' . $property->getScale() . ');'; |
|
| 181 | + if ( ! empty($property->getScale())) { |
|
| 182 | + $lines[] = '$property->setScale('.$property->getScale().');'; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - if (! empty($property->getPrecision())) { |
|
| 186 | - $lines[] = '$property->setPrecision(' . $property->getPrecision() . ');'; |
|
| 185 | + if ( ! empty($property->getPrecision())) { |
|
| 186 | + $lines[] = '$property->setPrecision('.$property->getPrecision().');'; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - $lines[] = '$property->setOptions(' . $this->varExport($property->getOptions()) . ');'; |
|
| 190 | - $lines[] = '$property->setPrimaryKey(' . $this->varExport($property->isPrimaryKey()) . ');'; |
|
| 191 | - $lines[] = '$property->setNullable(' . $this->varExport($property->isNullable()) . ');'; |
|
| 192 | - $lines[] = '$property->setUnique(' . $this->varExport($property->isUnique()) . ');'; |
|
| 189 | + $lines[] = '$property->setOptions('.$this->varExport($property->getOptions()).');'; |
|
| 190 | + $lines[] = '$property->setPrimaryKey('.$this->varExport($property->isPrimaryKey()).');'; |
|
| 191 | + $lines[] = '$property->setNullable('.$this->varExport($property->isNullable()).');'; |
|
| 192 | + $lines[] = '$property->setUnique('.$this->varExport($property->isUnique()).');'; |
|
| 193 | 193 | $lines[] = null; |
| 194 | 194 | $lines[] = '$metadata->addProperty($property);'; |
| 195 | 195 | } |
@@ -211,25 +211,25 @@ discard block |
||
| 211 | 211 | if ($association instanceof OneToOneAssociationMetadata) { |
| 212 | 212 | $this->exportJoinColumns($association->getJoinColumns(), $lines, 'joinColumns'); |
| 213 | 213 | |
| 214 | - $lines[] = '$association = new Mapping\OneToOneAssociationMetadata("' . $association->getName() . '");'; |
|
| 214 | + $lines[] = '$association = new Mapping\OneToOneAssociationMetadata("'.$association->getName().'");'; |
|
| 215 | 215 | $lines[] = null; |
| 216 | 216 | $lines[] = '$association->setJoinColumns($joinColumns);'; |
| 217 | 217 | } else if ($association instanceof ManyToOneAssociationMetadata) { |
| 218 | 218 | $this->exportJoinColumns($association->getJoinColumns(), $lines, 'joinColumns'); |
| 219 | 219 | |
| 220 | - $lines[] = '$association = new Mapping\ManyToOneAssociationMetadata("' . $association->getName() . '");'; |
|
| 220 | + $lines[] = '$association = new Mapping\ManyToOneAssociationMetadata("'.$association->getName().'");'; |
|
| 221 | 221 | $lines[] = null; |
| 222 | 222 | $lines[] = '$association->setJoinColumns($joinColumns);'; |
| 223 | 223 | } else if ($association instanceof OneToManyAssociationMetadata) { |
| 224 | - $lines[] = '$association = new Mapping\OneToManyAssociationMetadata("' . $association->getName() . '");'; |
|
| 224 | + $lines[] = '$association = new Mapping\OneToManyAssociationMetadata("'.$association->getName().'");'; |
|
| 225 | 225 | $lines[] = null; |
| 226 | - $lines[] = '$association->setOrderBy(' . $this->varExport($association->getOrderBy()) . ');'; |
|
| 226 | + $lines[] = '$association->setOrderBy('.$this->varExport($association->getOrderBy()).');'; |
|
| 227 | 227 | } else if ($association instanceof ManyToManyAssociationMetadata) { |
| 228 | 228 | if ($association->getJoinTable()) { |
| 229 | 229 | $this->exportJoinTable($association->getJoinTable(), $lines); |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - $lines[] = '$association = new Mapping\ManyToManyAssociationMetadata("' . $association->getName() . '");'; |
|
| 232 | + $lines[] = '$association = new Mapping\ManyToManyAssociationMetadata("'.$association->getName().'");'; |
|
| 233 | 233 | $lines[] = null; |
| 234 | 234 | |
| 235 | 235 | if ($association->getJoinTable()) { |
@@ -237,26 +237,26 @@ discard block |
||
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | if ($association->getIndexedBy()) { |
| 240 | - $lines[] = '$association->setIndexedBy("' . $association->getIndexedBy() . '");'; |
|
| 240 | + $lines[] = '$association->setIndexedBy("'.$association->getIndexedBy().'");'; |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - $lines[] = '$association->setOrderBy(' . $this->varExport($association->getOrderBy()) . ');'; |
|
| 243 | + $lines[] = '$association->setOrderBy('.$this->varExport($association->getOrderBy()).');'; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - $lines[] = '$association->setTargetEntity("' . $association->getTargetEntity() . '");'; |
|
| 247 | - $lines[] = '$association->setFetchMode("' . $association->getFetchMode() . '");'; |
|
| 246 | + $lines[] = '$association->setTargetEntity("'.$association->getTargetEntity().'");'; |
|
| 247 | + $lines[] = '$association->setFetchMode("'.$association->getFetchMode().'");'; |
|
| 248 | 248 | |
| 249 | 249 | if ($association->getMappedBy()) { |
| 250 | - $lines[] = '$association->setMappedBy("' . $association->getMappedBy() . '");'; |
|
| 250 | + $lines[] = '$association->setMappedBy("'.$association->getMappedBy().'");'; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | if ($association->getInversedBy()) { |
| 254 | - $lines[] = '$association->setInversedBy("' . $association->getInversedBy() . '");'; |
|
| 254 | + $lines[] = '$association->setInversedBy("'.$association->getInversedBy().'");'; |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - $lines[] = '$association->setCascade(' . $this->varExport($cascade) . ');'; |
|
| 258 | - $lines[] = '$association->setOrphanRemoval(' . $this->varExport($association->isOrphanRemoval()) . ');'; |
|
| 259 | - $lines[] = '$association->setPrimaryKey(' . $this->varExport($association->isPrimaryKey()) . ');'; |
|
| 257 | + $lines[] = '$association->setCascade('.$this->varExport($cascade).');'; |
|
| 258 | + $lines[] = '$association->setOrphanRemoval('.$this->varExport($association->isOrphanRemoval()).');'; |
|
| 259 | + $lines[] = '$association->setPrimaryKey('.$this->varExport($association->isPrimaryKey()).');'; |
|
| 260 | 260 | $lines[] = null; |
| 261 | 261 | $lines[] = '$metadata->addProperty($association);'; |
| 262 | 262 | } |
@@ -266,13 +266,13 @@ discard block |
||
| 266 | 266 | $lines[] = null; |
| 267 | 267 | $lines[] = '$joinTable = new Mapping\JoinTableMetadata();'; |
| 268 | 268 | $lines[] = null; |
| 269 | - $lines[] = '$joinTable->setName("' . $joinTable->getName() . '");'; |
|
| 269 | + $lines[] = '$joinTable->setName("'.$joinTable->getName().'");'; |
|
| 270 | 270 | |
| 271 | - if (! empty($joinTable->getSchema())) { |
|
| 272 | - $lines[] = '$joinTable->setSchema("' . $joinTable->getSchema() . '");'; |
|
| 271 | + if ( ! empty($joinTable->getSchema())) { |
|
| 272 | + $lines[] = '$joinTable->setSchema("'.$joinTable->getSchema().'");'; |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - $lines[] = '$joinTable->setOptions(' . $this->varExport($joinTable->getOptions()) . ');'; |
|
| 275 | + $lines[] = '$joinTable->setOptions('.$this->varExport($joinTable->getOptions()).');'; |
|
| 276 | 276 | |
| 277 | 277 | $this->exportJoinColumns($joinTable->getJoinColumns(), $lines, 'joinColumns'); |
| 278 | 278 | |
@@ -292,24 +292,24 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | private function exportJoinColumns(array $joinColumns, array &$lines, $variableName) |
| 294 | 294 | { |
| 295 | - $lines[] = '$' . $variableName . ' = array();'; |
|
| 295 | + $lines[] = '$'.$variableName.' = array();'; |
|
| 296 | 296 | |
| 297 | 297 | foreach ($joinColumns as $joinColumn) { |
| 298 | 298 | /** @var JoinColumnMetadata $joinColumn */ |
| 299 | 299 | $lines[] = '$joinColumn = new Mapping\JoinColumnMetadata();'; |
| 300 | 300 | $lines[] = null; |
| 301 | - $lines[] = '$joinColumn->setTableName("' . $joinColumn->getTableName() . '");'; |
|
| 302 | - $lines[] = '$joinColumn->setColumnName("' . $joinColumn->getColumnName() . '");'; |
|
| 303 | - $lines[] = '$joinColumn->setReferencedColumnName("' . $joinColumn->getReferencedColumnName() . '");'; |
|
| 304 | - $lines[] = '$joinColumn->setAliasedName("' . $joinColumn->getAliasedName() . '");'; |
|
| 305 | - $lines[] = '$joinColumn->setColumnDefinition("' . $joinColumn->getColumnDefinition() . '");'; |
|
| 306 | - $lines[] = '$joinColumn->setOnDelete("' . $joinColumn->getOnDelete() . '");'; |
|
| 307 | - $lines[] = '$joinColumn->setOptions(' . $this->varExport($joinColumn->getOptions()) . ');'; |
|
| 308 | - $lines[] = '$joinColumn->setNullable("' . $joinColumn->isNullable() . '");'; |
|
| 309 | - $lines[] = '$joinColumn->setUnique("' . $joinColumn->isUnique() . '");'; |
|
| 310 | - $lines[] = '$joinColumn->setPrimaryKey("' . $joinColumn->isPrimaryKey() . '");'; |
|
| 301 | + $lines[] = '$joinColumn->setTableName("'.$joinColumn->getTableName().'");'; |
|
| 302 | + $lines[] = '$joinColumn->setColumnName("'.$joinColumn->getColumnName().'");'; |
|
| 303 | + $lines[] = '$joinColumn->setReferencedColumnName("'.$joinColumn->getReferencedColumnName().'");'; |
|
| 304 | + $lines[] = '$joinColumn->setAliasedName("'.$joinColumn->getAliasedName().'");'; |
|
| 305 | + $lines[] = '$joinColumn->setColumnDefinition("'.$joinColumn->getColumnDefinition().'");'; |
|
| 306 | + $lines[] = '$joinColumn->setOnDelete("'.$joinColumn->getOnDelete().'");'; |
|
| 307 | + $lines[] = '$joinColumn->setOptions('.$this->varExport($joinColumn->getOptions()).');'; |
|
| 308 | + $lines[] = '$joinColumn->setNullable("'.$joinColumn->isNullable().'");'; |
|
| 309 | + $lines[] = '$joinColumn->setUnique("'.$joinColumn->isUnique().'");'; |
|
| 310 | + $lines[] = '$joinColumn->setPrimaryKey("'.$joinColumn->isPrimaryKey().'");'; |
|
| 311 | 311 | $lines[] = null; |
| 312 | - $lines[] = '$' . $variableName . '[] = $joinColumn;'; |
|
| 312 | + $lines[] = '$'.$variableName.'[] = $joinColumn;'; |
|
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | 315 | |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | protected function varExport($var) |
| 322 | 322 | { |
| 323 | 323 | $export = var_export($var, true); |
| 324 | - $export = str_replace("\n", PHP_EOL . str_repeat(' ', 8), $export); |
|
| 324 | + $export = str_replace("\n", PHP_EOL.str_repeat(' ', 8), $export); |
|
| 325 | 325 | $export = str_replace(' ', ' ', $export); |
| 326 | 326 | $export = str_replace('array (', 'array(', $export); |
| 327 | 327 | $export = str_replace('array( ', 'array(', $export); |
@@ -21,9 +21,7 @@ |
||
| 21 | 21 | |
| 22 | 22 | namespace Doctrine\ORM\Tools\Pagination; |
| 23 | 23 | |
| 24 | -use Doctrine\DBAL\Types\Type; |
|
| 25 | 24 | use Doctrine\ORM\Mapping\AssociationMetadata; |
| 26 | -use Doctrine\ORM\Mapping\ClassMetadata; |
|
| 27 | 25 | use Doctrine\ORM\Mapping\ToManyAssociationMetadata; |
| 28 | 26 | use Doctrine\ORM\Query; |
| 29 | 27 | use Doctrine\ORM\Query\TreeWalkerAdapter; |
@@ -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\ORM\Tools\Pagination; |
| 6 | 6 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | if ($property instanceof AssociationMetadata) { |
| 74 | 74 | throw new \RuntimeException( |
| 75 | - "Paginating an entity with foreign key as identifier only works when using the Output Walkers. " . |
|
| 75 | + "Paginating an entity with foreign key as identifier only works when using the Output Walkers. ". |
|
| 76 | 76 | "Call Paginator#setUseOutputWalkers(true) before iterating the paginator." |
| 77 | 77 | ); |
| 78 | 78 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | $AST->selectClause->selectExpressions[] = new SelectExpression( |
| 101 | 101 | $this->createSelectExpressionItem($item->expression), |
| 102 | - '_dctrn_ord' . $this->aliasCounter++ |
|
| 102 | + '_dctrn_ord'.$this->aliasCounter++ |
|
| 103 | 103 | ); |
| 104 | 104 | } |
| 105 | 105 | } |