@@ -25,8 +25,6 @@ |
||
25 | 25 | use Doctrine\DBAL\LockMode; |
26 | 26 | use Doctrine\DBAL\Types\Type; |
27 | 27 | use Doctrine\ORM\Mapping\AssociationMetadata; |
28 | -use Doctrine\ORM\Mapping\ClassMetadata; |
|
29 | -use Doctrine\ORM\Mapping\ColumnMetadata; |
|
30 | 28 | use Doctrine\ORM\Mapping\FieldMetadata; |
31 | 29 | use Doctrine\ORM\Mapping\GeneratorType; |
32 | 30 | use Doctrine\ORM\Mapping\ManyToManyAssociationMetadata; |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * <http://www.doctrine-project.org>. |
18 | 18 | */ |
19 | 19 | |
20 | -declare(strict_types=1); |
|
20 | +declare(strict_types = 1); |
|
21 | 21 | |
22 | 22 | namespace Doctrine\ORM\Persisters\Entity; |
23 | 23 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | foreach ($data as $columnName => $value) { |
131 | - if (!is_array($id) || !isset($id[$columnName])) { |
|
131 | + if ( ! is_array($id) || ! isset($id[$columnName])) { |
|
132 | 132 | $type = $this->columns[$columnName]->getType(); |
133 | 133 | |
134 | 134 | $stmt->bindValue($paramIndex++, $value, $type); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | |
253 | 253 | if ($filterSql = $this->generateFilterConditionSQL($rootClass, $tableAlias)) { |
254 | 254 | $conditionSql .= $conditionSql |
255 | - ? ' AND ' . $filterSql |
|
255 | + ? ' AND '.$filterSql |
|
256 | 256 | : $filterSql; |
257 | 257 | } |
258 | 258 | |
@@ -260,26 +260,26 @@ discard block |
||
260 | 260 | |
261 | 261 | switch ($lockMode) { |
262 | 262 | case LockMode::PESSIMISTIC_READ: |
263 | - $lockSql = ' ' . $this->platform->getReadLockSQL(); |
|
263 | + $lockSql = ' '.$this->platform->getReadLockSQL(); |
|
264 | 264 | break; |
265 | 265 | |
266 | 266 | case LockMode::PESSIMISTIC_WRITE: |
267 | - $lockSql = ' ' . $this->platform->getWriteLockSQL(); |
|
267 | + $lockSql = ' '.$this->platform->getWriteLockSQL(); |
|
268 | 268 | break; |
269 | 269 | } |
270 | 270 | |
271 | 271 | $tableName = $this->class->table->getQuotedQualifiedName($this->platform); |
272 | - $from = ' FROM ' . $tableName . ' ' . $baseTableAlias; |
|
273 | - $where = $conditionSql !== '' ? ' WHERE ' . $conditionSql : ''; |
|
272 | + $from = ' FROM '.$tableName.' '.$baseTableAlias; |
|
273 | + $where = $conditionSql !== '' ? ' WHERE '.$conditionSql : ''; |
|
274 | 274 | $lock = $this->platform->appendLockHint($from, $lockMode); |
275 | 275 | $columnList = $this->getSelectColumnsSQL(); |
276 | - $query = 'SELECT ' . $columnList |
|
276 | + $query = 'SELECT '.$columnList |
|
277 | 277 | . $lock |
278 | 278 | . $joinSql |
279 | 279 | . $where |
280 | 280 | . $orderBySql; |
281 | 281 | |
282 | - return $this->platform->modifyLimitQuery($query, $limit, $offset) . $lockSql; |
|
282 | + return $this->platform->modifyLimitQuery($query, $limit, $offset).$lockSql; |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
@@ -301,14 +301,14 @@ discard block |
||
301 | 301 | |
302 | 302 | if ('' !== $filterSql) { |
303 | 303 | $conditionSql = $conditionSql |
304 | - ? $conditionSql . ' AND ' . $filterSql |
|
304 | + ? $conditionSql.' AND '.$filterSql |
|
305 | 305 | : $filterSql; |
306 | 306 | } |
307 | 307 | |
308 | 308 | $sql = 'SELECT COUNT(*) ' |
309 | - . 'FROM ' . $tableName . ' ' . $baseTableAlias |
|
309 | + . 'FROM '.$tableName.' '.$baseTableAlias |
|
310 | 310 | . $joinSql |
311 | - . (empty($conditionSql) ? '' : ' WHERE ' . $conditionSql); |
|
311 | + . (empty($conditionSql) ? '' : ' WHERE '.$conditionSql); |
|
312 | 312 | |
313 | 313 | return $sql; |
314 | 314 | } |
@@ -328,18 +328,18 @@ discard block |
||
328 | 328 | $parentClass = $this->em->getClassMetadata($parentClassName); |
329 | 329 | $tableName = $parentClass->table->getQuotedQualifiedName($this->platform); |
330 | 330 | $tableAlias = $this->getSQLTableAlias($parentClass->getTableName()); |
331 | - $joinSql .= ' INNER JOIN ' . $tableName . ' ' . $tableAlias . ' ON '; |
|
331 | + $joinSql .= ' INNER JOIN '.$tableName.' '.$tableAlias.' ON '; |
|
332 | 332 | |
333 | 333 | foreach ($identifierColumns as $idColumn) { |
334 | 334 | $quotedColumnName = $this->platform->quoteIdentifier($idColumn->getColumnName()); |
335 | 335 | |
336 | - $conditions[] = $baseTableAlias . '.' . $quotedColumnName . ' = ' . $tableAlias . '.' . $quotedColumnName; |
|
336 | + $conditions[] = $baseTableAlias.'.'.$quotedColumnName.' = '.$tableAlias.'.'.$quotedColumnName; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | $joinSql .= implode(' AND ', $conditions); |
340 | 340 | } |
341 | 341 | |
342 | - return parent::getLockTablesSql($lockMode) . $joinSql; |
|
342 | + return parent::getLockTablesSql($lockMode).$joinSql; |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | /** |
@@ -366,14 +366,14 @@ discard block |
||
366 | 366 | continue; |
367 | 367 | } |
368 | 368 | |
369 | - if (! ($property instanceof ToOneAssociationMetadata) || ! $property->isOwningSide()) { |
|
369 | + if ( ! ($property instanceof ToOneAssociationMetadata) || ! $property->isOwningSide()) { |
|
370 | 370 | continue; |
371 | 371 | } |
372 | 372 | |
373 | 373 | $targetClass = $this->em->getClassMetadata($property->getTargetEntity()); |
374 | 374 | |
375 | 375 | foreach ($property->getJoinColumns() as $joinColumn) { |
376 | - if (! $joinColumn->getType()) { |
|
376 | + if ( ! $joinColumn->getType()) { |
|
377 | 377 | $joinColumn->setType( |
378 | 378 | PersisterHelper::getTypeOfColumn($joinColumn->getReferencedColumnName(), $targetClass, $this->em) |
379 | 379 | ); |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | $this->currentPersisterContext->rsm->addMetaResult('r', $resultColumnName, $discrColumnName, false, $discrColumnType); |
394 | 394 | |
395 | 395 | $columnList[] = $discrColumnType->convertToDatabaseValueSQL( |
396 | - $this->getSQLTableAlias($discrColumn->getTableName()) . '.' . $discrColumnName, |
|
396 | + $this->getSQLTableAlias($discrColumn->getTableName()).'.'.$discrColumnName, |
|
397 | 397 | $this->platform |
398 | 398 | ); |
399 | 399 | |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | $targetClass = $this->em->getClassMetadata($property->getTargetEntity()); |
421 | 421 | |
422 | 422 | foreach ($property->getJoinColumns() as $joinColumn) { |
423 | - if (! $joinColumn->getType()) { |
|
423 | + if ( ! $joinColumn->getType()) { |
|
424 | 424 | $joinColumn->setType( |
425 | 425 | PersisterHelper::getTypeOfColumn($joinColumn->getReferencedColumnName(), $targetClass, $this->em) |
426 | 426 | ); |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $columnName = $joinColumn->getColumnName(); |
469 | 469 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
470 | 470 | |
471 | - if (! $joinColumn->getType()) { |
|
471 | + if ( ! $joinColumn->getType()) { |
|
472 | 472 | $joinColumn->setType( |
473 | 473 | PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $this->em) |
474 | 474 | ); |
@@ -526,12 +526,12 @@ discard block |
||
526 | 526 | $parentClass = $this->em->getClassMetadata($parentClassName); |
527 | 527 | $tableName = $parentClass->table->getQuotedQualifiedName($this->platform); |
528 | 528 | $tableAlias = $this->getSQLTableAlias($parentClass->getTableName()); |
529 | - $joinSql .= ' INNER JOIN ' . $tableName . ' ' . $tableAlias . ' ON '; |
|
529 | + $joinSql .= ' INNER JOIN '.$tableName.' '.$tableAlias.' ON '; |
|
530 | 530 | |
531 | 531 | foreach ($identifierColumns as $idColumn) { |
532 | 532 | $quotedColumnName = $this->platform->quoteIdentifier($idColumn->getColumnName()); |
533 | 533 | |
534 | - $conditions[] = $baseTableAlias . '.' . $quotedColumnName . ' = ' . $tableAlias . '.' . $quotedColumnName; |
|
534 | + $conditions[] = $baseTableAlias.'.'.$quotedColumnName.' = '.$tableAlias.'.'.$quotedColumnName; |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | $joinSql .= implode(' AND ', $conditions); |
@@ -543,12 +543,12 @@ discard block |
||
543 | 543 | $subClass = $this->em->getClassMetadata($subClassName); |
544 | 544 | $tableName = $subClass->table->getQuotedQualifiedName($this->platform); |
545 | 545 | $tableAlias = $this->getSQLTableAlias($subClass->getTableName()); |
546 | - $joinSql .= ' LEFT JOIN ' . $tableName . ' ' . $tableAlias . ' ON '; |
|
546 | + $joinSql .= ' LEFT JOIN '.$tableName.' '.$tableAlias.' ON '; |
|
547 | 547 | |
548 | 548 | foreach ($identifierColumns as $idColumn) { |
549 | 549 | $quotedColumnName = $this->platform->quoteIdentifier($idColumn->getColumnName()); |
550 | 550 | |
551 | - $conditions[] = $baseTableAlias . '.' . $quotedColumnName . ' = ' . $tableAlias . '.' . $quotedColumnName; |
|
551 | + $conditions[] = $baseTableAlias.'.'.$quotedColumnName.' = '.$tableAlias.'.'.$quotedColumnName; |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | $joinSql .= implode(' AND ', $conditions); |
@@ -25,7 +25,6 @@ |
||
25 | 25 | use Doctrine\ORM\Mapping\ClassMetadata; |
26 | 26 | use Doctrine\Common\Collections\Criteria; |
27 | 27 | use Doctrine\ORM\Mapping\FieldMetadata; |
28 | -use Doctrine\ORM\Mapping\ToManyAssociationMetadata; |
|
29 | 28 | use Doctrine\ORM\Mapping\ToOneAssociationMetadata; |
30 | 29 | use Doctrine\ORM\Utility\PersisterHelper; |
31 | 30 |
@@ -56,7 +56,7 @@ |
||
56 | 56 | $rootClass = $this->em->getClassMetadata($this->class->getRootClassName()); |
57 | 57 | $tableAlias = $this->getSQLTableAlias($rootClass->getTableName()); |
58 | 58 | |
59 | - // Append discriminator column |
|
59 | + // Append discriminator column |
|
60 | 60 | $discrColumn = $this->class->discriminatorColumn; |
61 | 61 | $discrColumnName = $discrColumn->getColumnName(); |
62 | 62 | $discrColumnType = $discrColumn->getType(); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * <http://www.doctrine-project.org>. |
18 | 18 | */ |
19 | 19 | |
20 | -declare(strict_types=1); |
|
20 | +declare(strict_types = 1); |
|
21 | 21 | |
22 | 22 | namespace Doctrine\ORM\Persisters\Entity; |
23 | 23 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->currentPersisterContext->rsm->setDiscriminatorColumn('r', $resultColumnName); |
67 | 67 | $this->currentPersisterContext->rsm->addMetaResult('r', $resultColumnName, $discrColumnName, false, $discrColumnType); |
68 | 68 | |
69 | - $columnList[] = $discrColumnType->convertToDatabaseValueSQL($tableAlias . '.' . $quotedColumnName, $this->platform); |
|
69 | + $columnList[] = $discrColumnType->convertToDatabaseValueSQL($tableAlias.'.'.$quotedColumnName, $this->platform); |
|
70 | 70 | |
71 | 71 | // Append subclass columns |
72 | 72 | foreach ($this->class->getSubClasses() as $subClassName) { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $targetClass = $this->em->getClassMetadata($property->getTargetEntity()); |
88 | 88 | |
89 | 89 | foreach ($property->getJoinColumns() as $joinColumn) { |
90 | - if (! $joinColumn->getType()) { |
|
90 | + if ( ! $joinColumn->getType()) { |
|
91 | 91 | $joinColumn->setType( |
92 | 92 | PersisterHelper::getTypeOfColumn($joinColumn->getReferencedColumnName(), $targetClass, $this->em) |
93 | 93 | ); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $conditionSql .= ' AND '; |
144 | 144 | } |
145 | 145 | |
146 | - return $conditionSql . $this->getSelectConditionDiscriminatorValueSQL(); |
|
146 | + return $conditionSql.$this->getSelectConditionDiscriminatorValueSQL(); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $conditionSql .= ' AND '; |
158 | 158 | } |
159 | 159 | |
160 | - return $conditionSql . $this->getSelectConditionDiscriminatorValueSQL(); |
|
160 | + return $conditionSql.$this->getSelectConditionDiscriminatorValueSQL(); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | |
185 | 185 | return sprintf( |
186 | 186 | '%s IN (%s)', |
187 | - $discrColumnType->convertToDatabaseValueSQL($tableAlias . '.' . $quotedColumnName, $this->platform), |
|
187 | + $discrColumnType->convertToDatabaseValueSQL($tableAlias.'.'.$quotedColumnName, $this->platform), |
|
188 | 188 | implode(', ', $values) |
189 | 189 | ); |
190 | 190 | } |
@@ -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 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * <http://www.doctrine-project.org>. |
18 | 18 | */ |
19 | 19 | |
20 | -declare(strict_types=1); |
|
20 | +declare(strict_types = 1); |
|
21 | 21 | |
22 | 22 | namespace Doctrine\ORM\Query\Exec; |
23 | 23 | |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | // 1. Create an INSERT INTO temptable ... SELECT identifiers WHERE $AST->getWhereClause() |
79 | 79 | $sqlWalker->setSQLTableAlias($primaryClass->getTableName(), 'i0', $primaryDqlAlias); |
80 | 80 | |
81 | - $this->insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnNameList . ')' |
|
82 | - . ' SELECT i0.' . implode(', i0.', array_keys($idColumns)); |
|
81 | + $this->insertSql = 'INSERT INTO '.$tempTable.' ('.$idColumnNameList.')' |
|
82 | + . ' SELECT i0.'.implode(', i0.', array_keys($idColumns)); |
|
83 | 83 | |
84 | 84 | $rangeDecl = new AST\RangeVariableDeclaration($primaryClass->getClassName(), $primaryDqlAlias); |
85 | 85 | $fromClause = new AST\FromClause([new AST\IdentificationVariableDeclaration($rangeDecl, null, [])]); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | // 2. Create ID subselect statement used in DELETE ... WHERE ... IN (subselect) |
94 | - $idSubselect = 'SELECT ' . $idColumnNameList . ' FROM ' . $tempTable; |
|
94 | + $idSubselect = 'SELECT '.$idColumnNameList.' FROM '.$tempTable; |
|
95 | 95 | |
96 | 96 | // 3. Create and store DELETE statements |
97 | 97 | $classNames = array_merge( |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | $parentClass = $em->getClassMetadata($className); |
105 | 105 | $tableName = $parentClass->table->getQuotedQualifiedName($platform); |
106 | 106 | |
107 | - $this->sqlStatements[] = 'DELETE FROM ' . $tableName |
|
108 | - . ' WHERE (' . $idColumnNameList . ') IN (' . $idSubselect . ')'; |
|
107 | + $this->sqlStatements[] = 'DELETE FROM '.$tableName |
|
108 | + . ' WHERE ('.$idColumnNameList.') IN ('.$idSubselect.')'; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | // 4. Store DDL for temporary identifier table. |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | ]; |
119 | 119 | } |
120 | 120 | |
121 | - $this->createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' (' |
|
122 | - . $platform->getColumnDeclarationListSQL($columnDefinitions) . ')'; |
|
121 | + $this->createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL().' '.$tempTable.' (' |
|
122 | + . $platform->getColumnDeclarationListSQL($columnDefinitions).')'; |
|
123 | 123 | |
124 | 124 | $this->dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable); |
125 | 125 | } |
@@ -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 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * <http://www.doctrine-project.org>. |
18 | 18 | */ |
19 | 19 | |
20 | -declare(strict_types=1); |
|
20 | +declare(strict_types = 1); |
|
21 | 21 | |
22 | 22 | namespace Doctrine\ORM\Query\Exec; |
23 | 23 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | // 1. Create an INSERT INTO temptable ... SELECT identifiers WHERE $AST->getWhereClause() |
90 | 90 | $sqlWalker->setSQLTableAlias($primaryClass->getTableName(), 'i0', $updateClause->aliasIdentificationVariable); |
91 | 91 | |
92 | - $this->insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnNameList . ')' |
|
93 | - . ' SELECT i0.' . implode(', i0.', array_keys($idColumns)); |
|
92 | + $this->insertSql = 'INSERT INTO '.$tempTable.' ('.$idColumnNameList.')' |
|
93 | + . ' SELECT i0.'.implode(', i0.', array_keys($idColumns)); |
|
94 | 94 | |
95 | 95 | $rangeDecl = new AST\RangeVariableDeclaration($primaryClass->getClassName(), $updateClause->aliasIdentificationVariable); |
96 | 96 | $fromClause = new AST\FromClause([new AST\IdentificationVariableDeclaration($rangeDecl, null, [])]); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $this->insertSql .= $sqlWalker->walkFromClause($fromClause); |
99 | 99 | |
100 | 100 | // 2. Create ID subselect statement used in UPDATE ... WHERE ... IN (subselect) |
101 | - $idSubselect = 'SELECT ' . $idColumnNameList . ' FROM ' . $tempTable; |
|
101 | + $idSubselect = 'SELECT '.$idColumnNameList.' FROM '.$tempTable; |
|
102 | 102 | |
103 | 103 | // 3. Create and store UPDATE statements |
104 | 104 | $classNames = array_merge( |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $affected = false; |
114 | 114 | $class = $em->getClassMetadata($className); |
115 | 115 | $tableName = $class->table->getQuotedQualifiedName($platform); |
116 | - $updateSql = 'UPDATE ' . $tableName . ' SET '; |
|
116 | + $updateSql = 'UPDATE '.$tableName.' SET '; |
|
117 | 117 | |
118 | 118 | foreach ($updateItems as $updateItem) { |
119 | 119 | $field = $updateItem->pathExpression->field; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | if ($affected) { |
143 | - $this->sqlStatements[$i] = $updateSql . ' WHERE (' . $idColumnNameList . ') IN (' . $idSubselect . ')'; |
|
143 | + $this->sqlStatements[$i] = $updateSql.' WHERE ('.$idColumnNameList.') IN ('.$idSubselect.')'; |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | ]; |
160 | 160 | } |
161 | 161 | |
162 | - $this->createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' (' |
|
163 | - . $platform->getColumnDeclarationListSQL($columnDefinitions) . ')'; |
|
162 | + $this->createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL().' '.$tempTable.' (' |
|
163 | + . $platform->getColumnDeclarationListSQL($columnDefinitions).')'; |
|
164 | 164 | |
165 | 165 | $this->dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable); |
166 | 166 | } |
@@ -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 | { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * <http://www.doctrine-project.org>. |
18 | 18 | */ |
19 | 19 | |
20 | -declare(strict_types=1); |
|
20 | +declare(strict_types = 1); |
|
21 | 21 | |
22 | 22 | namespace Doctrine\ORM\Tools\Console\Command; |
23 | 23 | |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | |
177 | 177 | $matches = array_filter( |
178 | 178 | $this->getMappedEntities($entityManager), |
179 | - function ($mappedEntity) use ($entityName) { |
|
180 | - return preg_match('{' . preg_quote($entityName) . '}', $mappedEntity); |
|
179 | + function($mappedEntity) use ($entityName) { |
|
180 | + return preg_match('{'.preg_quote($entityName).'}', $mappedEntity); |
|
181 | 181 | } |
182 | 182 | ); |
183 | 183 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | if (is_bool($value)) { |
219 | - return '<comment>' . ($value ? 'True' : 'False') . '</comment>'; |
|
219 | + return '<comment>'.($value ? 'True' : 'False').'</comment>'; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | if (empty($value)) { |
@@ -298,7 +298,7 @@ discard block |
||
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)); |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | return $this->formatField( |
355 | 355 | 'Entity listeners', |
356 | 356 | array_map( |
357 | - function ($entityListener) { |
|
357 | + function($entityListener) { |
|
358 | 358 | return get_class($entityListener); |
359 | 359 | }, |
360 | 360 | $entityListeners |
@@ -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)); |
@@ -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; |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * <http://www.doctrine-project.org>. |
18 | 18 | */ |
19 | 19 | |
20 | -declare(strict_types=1); |
|
20 | +declare(strict_types = 1); |
|
21 | 21 | |
22 | 22 | namespace Doctrine\ORM\Tools; |
23 | 23 | |
@@ -93,20 +93,20 @@ discard block |
||
93 | 93 | fwrite($fh, "Flush Operation [".$this->context."] - Dumping identity map:\n"); |
94 | 94 | |
95 | 95 | foreach ($identityMap as $className => $map) { |
96 | - fwrite($fh, "Class: ". $className . "\n"); |
|
96 | + fwrite($fh, "Class: ".$className."\n"); |
|
97 | 97 | |
98 | 98 | foreach ($map as $entity) { |
99 | - fwrite($fh, " Entity: " . $this->getIdString($entity, $uow) . " " . spl_object_hash($entity)."\n"); |
|
99 | + fwrite($fh, " Entity: ".$this->getIdString($entity, $uow)." ".spl_object_hash($entity)."\n"); |
|
100 | 100 | fwrite($fh, " Associations:\n"); |
101 | 101 | |
102 | 102 | $cm = $em->getClassMetadata($className); |
103 | 103 | |
104 | 104 | foreach ($cm->getProperties() as $field => $association) { |
105 | - if (! ($association instanceof AssociationMetadata)) { |
|
105 | + if ( ! ($association instanceof AssociationMetadata)) { |
|
106 | 106 | continue; |
107 | 107 | } |
108 | 108 | |
109 | - fwrite($fh, " " . $field . " "); |
|
109 | + fwrite($fh, " ".$field." "); |
|
110 | 110 | |
111 | 111 | $value = $association->getValue($entity); |
112 | 112 | |
@@ -117,25 +117,25 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | if ($association instanceof ToOneAssociationMetadata) { |
120 | - if ($value instanceof Proxy && !$value->__isInitialized()) { |
|
120 | + if ($value instanceof Proxy && ! $value->__isInitialized()) { |
|
121 | 121 | fwrite($fh, "[PROXY] "); |
122 | 122 | } |
123 | 123 | |
124 | - fwrite($fh, $this->getIdString($value, $uow) . " " . spl_object_hash($value) . "\n"); |
|
124 | + fwrite($fh, $this->getIdString($value, $uow)." ".spl_object_hash($value)."\n"); |
|
125 | 125 | } else { |
126 | - $initialized = !($value instanceof PersistentCollection) || $value->isInitialized(); |
|
126 | + $initialized = ! ($value instanceof PersistentCollection) || $value->isInitialized(); |
|
127 | 127 | |
128 | 128 | if ($initialized) { |
129 | - fwrite($fh, "[INITIALIZED] " . $this->getType($value). " " . count($value) . " elements\n"); |
|
129 | + fwrite($fh, "[INITIALIZED] ".$this->getType($value)." ".count($value)." elements\n"); |
|
130 | 130 | |
131 | 131 | foreach ($value as $obj) { |
132 | - fwrite($fh, " " . $this->getIdString($obj, $uow) . " " . spl_object_hash($obj)."\n"); |
|
132 | + fwrite($fh, " ".$this->getIdString($obj, $uow)." ".spl_object_hash($obj)."\n"); |
|
133 | 133 | } |
134 | 134 | } else { |
135 | - fwrite($fh, "[PROXY] " . $this->getType($value) . " unknown element size\n"); |
|
135 | + fwrite($fh, "[PROXY] ".$this->getType($value)." unknown element size\n"); |
|
136 | 136 | |
137 | 137 | foreach ($value->unwrap() as $obj) { |
138 | - fwrite($fh, " " . $this->getIdString($obj, $uow) . " " . spl_object_hash($obj)."\n"); |
|
138 | + fwrite($fh, " ".$this->getIdString($obj, $uow)." ".spl_object_hash($obj)."\n"); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | } |
@@ -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( |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * <http://www.doctrine-project.org>. |
18 | 18 | */ |
19 | 19 | |
20 | -declare(strict_types=1); |
|
20 | +declare(strict_types = 1); |
|
21 | 21 | |
22 | 22 | namespace Doctrine\ORM\Tools; |
23 | 23 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | */ |
346 | 346 | public function writeEntityClass(ClassMetadata $metadata, $outputDirectory) |
347 | 347 | { |
348 | - $path = $outputDirectory . '/' . str_replace('\\', DIRECTORY_SEPARATOR, $metadata->getClassName()) . $this->extension; |
|
348 | + $path = $outputDirectory.'/'.str_replace('\\', DIRECTORY_SEPARATOR, $metadata->getClassName()).$this->extension; |
|
349 | 349 | $dir = dirname($path); |
350 | 350 | |
351 | 351 | if ( ! is_dir($dir)) { |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | } |
362 | 362 | |
363 | 363 | if ($this->backupExisting && file_exists($path)) { |
364 | - $backupPath = dirname($path) . DIRECTORY_SEPARATOR . basename($path) . "~"; |
|
365 | - if (!copy($path, $backupPath)) { |
|
364 | + $backupPath = dirname($path).DIRECTORY_SEPARATOR.basename($path)."~"; |
|
365 | + if ( ! copy($path, $backupPath)) { |
|
366 | 366 | throw new \RuntimeException("Attempt to backup overwritten entity file but copy operation failed."); |
367 | 367 | } |
368 | 368 | } |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $body = str_replace('<spaces>', $this->spaces, $body); |
424 | 424 | $last = strrpos($currentCode, '}'); |
425 | 425 | |
426 | - return substr($currentCode, 0, $last) . $body . ($body ? "\n" : '') . "}\n"; |
|
426 | + return substr($currentCode, 0, $last).$body.($body ? "\n" : '')."}\n"; |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | /** |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | public function setFieldVisibility($visibility) |
488 | 488 | { |
489 | 489 | if ($visibility !== static::FIELD_VISIBLE_PRIVATE && $visibility !== static::FIELD_VISIBLE_PROTECTED) { |
490 | - throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): ' . $visibility); |
|
490 | + throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): '.$visibility); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | $this->fieldVisibility = $visibility; |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | protected function generateEntityNamespace(ClassMetadata $metadata) |
586 | 586 | { |
587 | 587 | if ($this->hasNamespace($metadata)) { |
588 | - return 'namespace ' . $this->getNamespace($metadata) .';'; |
|
588 | + return 'namespace '.$this->getNamespace($metadata).';'; |
|
589 | 589 | } |
590 | 590 | } |
591 | 591 | |
@@ -605,8 +605,8 @@ discard block |
||
605 | 605 | */ |
606 | 606 | protected function generateEntityClassName(ClassMetadata $metadata) |
607 | 607 | { |
608 | - return 'class ' . $this->getClassName($metadata) . |
|
609 | - ($this->extendsClass() ? ' extends ' . $this->getClassToExtendName() : null); |
|
608 | + return 'class '.$this->getClassName($metadata). |
|
609 | + ($this->extendsClass() ? ' extends '.$this->getClassToExtendName() : null); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | /** |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | $optionalFields = []; |
692 | 692 | |
693 | 693 | foreach ($metadata->getProperties() as $property) { |
694 | - if (! $property->isNullable()) { |
|
694 | + if ( ! $property->isNullable()) { |
|
695 | 695 | $requiredFields[] = $property; |
696 | 696 | |
697 | 697 | continue; |
@@ -720,13 +720,13 @@ discard block |
||
720 | 720 | $fieldName = $property->getName(); |
721 | 721 | $fieldType = $property->getTypeName(); |
722 | 722 | $mappedType = $this->getType($fieldType); |
723 | - $param = '$' . $fieldName; |
|
723 | + $param = '$'.$fieldName; |
|
724 | 724 | |
725 | - $paramTypes[] = $mappedType . ($property->isNullable() ? '|null' : ''); |
|
725 | + $paramTypes[] = $mappedType.($property->isNullable() ? '|null' : ''); |
|
726 | 726 | $paramVariables[] = $param; |
727 | 727 | |
728 | 728 | if ($fieldType === 'datetime') { |
729 | - $param = $mappedType . ' ' . $param; |
|
729 | + $param = $mappedType.' '.$param; |
|
730 | 730 | } |
731 | 731 | |
732 | 732 | if ($property->isNullable()) { |
@@ -735,13 +735,13 @@ discard block |
||
735 | 735 | |
736 | 736 | $params[] = $param; |
737 | 737 | |
738 | - $fields[] = '$this->' . $fieldName . ' = $' . $fieldName . ';'; |
|
738 | + $fields[] = '$this->'.$fieldName.' = $'.$fieldName.';'; |
|
739 | 739 | } |
740 | 740 | |
741 | 741 | $maxParamTypeLength = max(array_map('strlen', $paramTypes)); |
742 | 742 | $paramTags = array_map( |
743 | - function ($type, $variable) use ($maxParamTypeLength) { |
|
744 | - return '@param ' . $type . str_repeat(' ', $maxParamTypeLength - strlen($type) + 1) . $variable; |
|
743 | + function($type, $variable) use ($maxParamTypeLength) { |
|
744 | + return '@param '.$type.str_repeat(' ', $maxParamTypeLength - strlen($type) + 1).$variable; |
|
745 | 745 | }, |
746 | 746 | $paramTypes, |
747 | 747 | $paramVariables |
@@ -749,8 +749,8 @@ discard block |
||
749 | 749 | |
750 | 750 | // Generate multi line constructor if the signature exceeds 120 characters. |
751 | 751 | if (array_sum(array_map('strlen', $params)) + count($params) * 2 + 29 > 120) { |
752 | - $delimiter = "\n" . $this->spaces; |
|
753 | - $params = $delimiter . implode(',' . $delimiter, $params) . "\n"; |
|
752 | + $delimiter = "\n".$this->spaces; |
|
753 | + $params = $delimiter.implode(','.$delimiter, $params)."\n"; |
|
754 | 754 | } else { |
755 | 755 | $params = implode(', ', $params); |
756 | 756 | } |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | $replacements = [ |
759 | 759 | '<paramTags>' => implode("\n * ", $paramTags), |
760 | 760 | '<params>' => $params, |
761 | - '<fields>' => implode("\n" . $this->spaces, $fields), |
|
761 | + '<fields>' => implode("\n".$this->spaces, $fields), |
|
762 | 762 | ]; |
763 | 763 | |
764 | 764 | $constructor = str_replace( |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | |
804 | 804 | if ($inClass) { |
805 | 805 | $inClass = false; |
806 | - $lastSeenClass = $lastSeenNamespace . ($lastSeenNamespace ? '\\' : '') . $token[1]; |
|
806 | + $lastSeenClass = $lastSeenNamespace.($lastSeenNamespace ? '\\' : '').$token[1]; |
|
807 | 807 | $this->staticReflection[$lastSeenClass]['properties'] = []; |
808 | 808 | $this->staticReflection[$lastSeenClass]['methods'] = []; |
809 | 809 | } |
@@ -811,16 +811,16 @@ discard block |
||
811 | 811 | if (T_NAMESPACE === $token[0]) { |
812 | 812 | $lastSeenNamespace = ''; |
813 | 813 | $inNamespace = true; |
814 | - } elseif (T_CLASS === $token[0] && T_DOUBLE_COLON !== $tokens[$i-1][0]) { |
|
814 | + } elseif (T_CLASS === $token[0] && T_DOUBLE_COLON !== $tokens[$i - 1][0]) { |
|
815 | 815 | $inClass = true; |
816 | 816 | } elseif (T_FUNCTION === $token[0]) { |
817 | - if (T_STRING === $tokens[$i+2][0]) { |
|
818 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+2][1]); |
|
819 | - } elseif ($tokens[$i+2] == '&' && T_STRING === $tokens[$i+3][0]) { |
|
820 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+3][1]); |
|
817 | + if (T_STRING === $tokens[$i + 2][0]) { |
|
818 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 2][1]); |
|
819 | + } elseif ($tokens[$i + 2] == '&' && T_STRING === $tokens[$i + 3][0]) { |
|
820 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 3][1]); |
|
821 | 821 | } |
822 | - } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED], true) && T_FUNCTION !== $tokens[$i+2][0]) { |
|
823 | - $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i+2][1], 1); |
|
822 | + } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED], true) && T_FUNCTION !== $tokens[$i + 2][0]) { |
|
823 | + $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i + 2][1], 1); |
|
824 | 824 | } |
825 | 825 | } |
826 | 826 | } |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | */ |
834 | 834 | protected function hasProperty($property, ClassMetadata $metadata) |
835 | 835 | { |
836 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->getClassName()))) { |
|
836 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->getClassName()))) { |
|
837 | 837 | // don't generate property if its already on the base class. |
838 | 838 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->getClassName()); |
839 | 839 | |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | */ |
864 | 864 | protected function hasMethod($method, ClassMetadata $metadata) |
865 | 865 | { |
866 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->getClassName()))) { |
|
866 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->getClassName()))) { |
|
867 | 867 | // don't generate method if its already on the base class. |
868 | 868 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->getClassName()); |
869 | 869 | |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | */ |
893 | 893 | protected function getTraits(ClassMetadata $metadata) |
894 | 894 | { |
895 | - if (! ($metadata->getReflectionClass() !== null || class_exists($metadata->getClassName()))) { |
|
895 | + if ( ! ($metadata->getReflectionClass() !== null || class_exists($metadata->getClassName()))) { |
|
896 | 896 | return []; |
897 | 897 | } |
898 | 898 | |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | { |
942 | 942 | $refl = new \ReflectionClass($this->getClassToExtend()); |
943 | 943 | |
944 | - return '\\' . $refl->getName(); |
|
944 | + return '\\'.$refl->getName(); |
|
945 | 945 | } |
946 | 946 | |
947 | 947 | /** |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | { |
975 | 975 | $lines = []; |
976 | 976 | $lines[] = '/**'; |
977 | - $lines[] = ' * ' . $this->getClassName($metadata); |
|
977 | + $lines[] = ' * '.$this->getClassName($metadata); |
|
978 | 978 | |
979 | 979 | if ($this->generateAnnotations) { |
980 | 980 | $lines[] = ' *'; |
@@ -989,12 +989,12 @@ discard block |
||
989 | 989 | |
990 | 990 | foreach ($methods as $method) { |
991 | 991 | if ($code = $this->$method($metadata)) { |
992 | - $lines[] = ' * ' . $code; |
|
992 | + $lines[] = ' * '.$code; |
|
993 | 993 | } |
994 | 994 | } |
995 | 995 | |
996 | 996 | if (isset($metadata->lifecycleCallbacks) && $metadata->lifecycleCallbacks) { |
997 | - $lines[] = ' * @' . $this->annotationsPrefix . 'HasLifecycleCallbacks'; |
|
997 | + $lines[] = ' * @'.$this->annotationsPrefix.'HasLifecycleCallbacks'; |
|
998 | 998 | } |
999 | 999 | } |
1000 | 1000 | |
@@ -1010,17 +1010,17 @@ discard block |
||
1010 | 1010 | */ |
1011 | 1011 | protected function generateEntityAnnotation(ClassMetadata $metadata) |
1012 | 1012 | { |
1013 | - $prefix = '@' . $this->annotationsPrefix; |
|
1013 | + $prefix = '@'.$this->annotationsPrefix; |
|
1014 | 1014 | |
1015 | 1015 | if ($metadata->isEmbeddedClass) { |
1016 | - return $prefix . 'Embeddable'; |
|
1016 | + return $prefix.'Embeddable'; |
|
1017 | 1017 | } |
1018 | 1018 | |
1019 | 1019 | $customRepository = $metadata->getCustomRepositoryClassName() |
1020 | - ? '(repositoryClass="' . $metadata->getCustomRepositoryClassName() . '")' |
|
1020 | + ? '(repositoryClass="'.$metadata->getCustomRepositoryClassName().'")' |
|
1021 | 1021 | : ''; |
1022 | 1022 | |
1023 | - return $prefix . ($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity') . $customRepository; |
|
1023 | + return $prefix.($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity').$customRepository; |
|
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | /** |
@@ -1037,28 +1037,28 @@ discard block |
||
1037 | 1037 | $table = []; |
1038 | 1038 | |
1039 | 1039 | if ($metadata->table->getSchema()) { |
1040 | - $table[] = 'schema="' . $metadata->table->getSchema() . '"'; |
|
1040 | + $table[] = 'schema="'.$metadata->table->getSchema().'"'; |
|
1041 | 1041 | } |
1042 | 1042 | |
1043 | 1043 | if ($metadata->table->getName()) { |
1044 | - $table[] = 'name="' . $metadata->table->getName() . '"'; |
|
1044 | + $table[] = 'name="'.$metadata->table->getName().'"'; |
|
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | if ($metadata->table->getOptions()) { |
1048 | - $table[] = 'options={' . $this->exportTableOptions($metadata->table->getOptions()) . '}'; |
|
1048 | + $table[] = 'options={'.$this->exportTableOptions($metadata->table->getOptions()).'}'; |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | if ($metadata->table->getUniqueConstraints()) { |
1052 | 1052 | $constraints = $this->generateTableConstraints('UniqueConstraint', $metadata->table->getUniqueConstraints()); |
1053 | - $table[] = 'uniqueConstraints={' . $constraints . '}'; |
|
1053 | + $table[] = 'uniqueConstraints={'.$constraints.'}'; |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | if ($metadata->table->getIndexes()) { |
1057 | 1057 | $constraints = $this->generateTableConstraints('Index', $metadata->table->getIndexes()); |
1058 | - $table[] = 'indexes={' . $constraints . '}'; |
|
1058 | + $table[] = 'indexes={'.$constraints.'}'; |
|
1059 | 1059 | } |
1060 | 1060 | |
1061 | - return '@' . $this->annotationsPrefix . 'Table(' . implode(', ', $table) . ')'; |
|
1061 | + return '@'.$this->annotationsPrefix.'Table('.implode(', ', $table).')'; |
|
1062 | 1062 | } |
1063 | 1063 | |
1064 | 1064 | /** |
@@ -1075,10 +1075,10 @@ discard block |
||
1075 | 1075 | $columns = []; |
1076 | 1076 | |
1077 | 1077 | foreach ($constraint['columns'] as $column) { |
1078 | - $columns[] = '"' . $column . '"'; |
|
1078 | + $columns[] = '"'.$column.'"'; |
|
1079 | 1079 | } |
1080 | 1080 | |
1081 | - $annotations[] = '@' . $this->annotationsPrefix . $constraintName . '(name="' . $name . '", columns={' . implode(', ', $columns) . '})'; |
|
1081 | + $annotations[] = '@'.$this->annotationsPrefix.$constraintName.'(name="'.$name.'", columns={'.implode(', ', $columns).'})'; |
|
1082 | 1082 | } |
1083 | 1083 | |
1084 | 1084 | return implode(', ', $annotations); |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | protected function generateInheritanceAnnotation(ClassMetadata $metadata) |
1093 | 1093 | { |
1094 | 1094 | if ($metadata->inheritanceType !== InheritanceType::NONE) { |
1095 | - return '@' . $this->annotationsPrefix . 'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
1095 | + return '@'.$this->annotationsPrefix.'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
1096 | 1096 | } |
1097 | 1097 | } |
1098 | 1098 | |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | $discrColumn->getLength() |
1114 | 1114 | ); |
1115 | 1115 | |
1116 | - return '@' . $this->annotationsPrefix . 'DiscriminatorColumn(' . $columnDefinition . ')'; |
|
1116 | + return '@'.$this->annotationsPrefix.'DiscriminatorColumn('.$columnDefinition.')'; |
|
1117 | 1117 | } |
1118 | 1118 | } |
1119 | 1119 | |
@@ -1128,10 +1128,10 @@ discard block |
||
1128 | 1128 | $inheritanceClassMap = []; |
1129 | 1129 | |
1130 | 1130 | foreach ($metadata->discriminatorMap as $type => $class) { |
1131 | - $inheritanceClassMap[] .= '"' . $type . '" = "' . $class . '"'; |
|
1131 | + $inheritanceClassMap[] .= '"'.$type.'" = "'.$class.'"'; |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | - return '@' . $this->annotationsPrefix . 'DiscriminatorMap({' . implode(', ', $inheritanceClassMap) . '})'; |
|
1134 | + return '@'.$this->annotationsPrefix.'DiscriminatorMap({'.implode(', ', $inheritanceClassMap).'})'; |
|
1135 | 1135 | } |
1136 | 1136 | } |
1137 | 1137 | |
@@ -1162,7 +1162,7 @@ discard block |
||
1162 | 1162 | |
1163 | 1163 | foreach ($metadata->getProperties() as $fieldName => $property) { |
1164 | 1164 | if ($property instanceof FieldMetadata) { |
1165 | - $nullable = $property->isNullable() ? 'null' : null; |
|
1165 | + $nullable = $property->isNullable() ? 'null' : null; |
|
1166 | 1166 | |
1167 | 1167 | if ($code = $this->generateEntityStubMethod($metadata, 'get', $fieldName, $property->getTypeName(), $nullable)) { |
1168 | 1168 | $methods[] = $code; |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | ; |
1219 | 1219 | |
1220 | 1220 | foreach ($joinColumns as $joinColumn) { |
1221 | - if (! $joinColumn->isNullable()) { |
|
1221 | + if ( ! $joinColumn->isNullable()) { |
|
1222 | 1222 | return false; |
1223 | 1223 | } |
1224 | 1224 | } |
@@ -1270,7 +1270,7 @@ discard block |
||
1270 | 1270 | |
1271 | 1271 | if ($property instanceof FieldMetadata) { |
1272 | 1272 | $options = $property->getOptions(); |
1273 | - $defaultValue = isset($options['default']) ? ' = ' . var_export($options['default'], true) : null; |
|
1273 | + $defaultValue = isset($options['default']) ? ' = '.var_export($options['default'], true) : null; |
|
1274 | 1274 | |
1275 | 1275 | $lines[] = $this->generateFieldMappingPropertyDocBlock($property, $metadata); |
1276 | 1276 | } else { |
@@ -1279,7 +1279,7 @@ discard block |
||
1279 | 1279 | $lines[] = $this->generateAssociationMappingPropertyDocBlock($property, $metadata); |
1280 | 1280 | } |
1281 | 1281 | |
1282 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldName . $defaultValue . ";\n"; |
|
1282 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$fieldName.$defaultValue.";\n"; |
|
1283 | 1283 | } |
1284 | 1284 | |
1285 | 1285 | return implode("\n", $lines); |
@@ -1317,7 +1317,7 @@ discard block |
||
1317 | 1317 | */ |
1318 | 1318 | protected function generateEntityStubMethod(ClassMetadata $metadata, $type, $fieldName, $typeHint = null, $defaultValue = null) |
1319 | 1319 | { |
1320 | - $methodName = $type . Inflector::classify($fieldName); |
|
1320 | + $methodName = $type.Inflector::classify($fieldName); |
|
1321 | 1321 | $variableName = Inflector::camelize($fieldName); |
1322 | 1322 | |
1323 | 1323 | if (in_array($type, ["add", "remove"])) { |
@@ -1338,18 +1338,18 @@ discard block |
||
1338 | 1338 | $variableType = $typeHint ? $this->getType($typeHint) : null; |
1339 | 1339 | |
1340 | 1340 | if ($typeHint && ! isset($types[$typeHint])) { |
1341 | - $variableType = '\\' . ltrim($variableType, '\\'); |
|
1342 | - $methodTypeHint = '\\' . $typeHint . ' '; |
|
1341 | + $variableType = '\\'.ltrim($variableType, '\\'); |
|
1342 | + $methodTypeHint = '\\'.$typeHint.' '; |
|
1343 | 1343 | } |
1344 | 1344 | |
1345 | 1345 | $replacements = [ |
1346 | - '<description>' => ucfirst($type) . ' ' . $variableName . '.', |
|
1346 | + '<description>' => ucfirst($type).' '.$variableName.'.', |
|
1347 | 1347 | '<methodTypeHint>' => $methodTypeHint, |
1348 | - '<variableType>' => $variableType . (null !== $defaultValue ? ('|' . $defaultValue) : ''), |
|
1348 | + '<variableType>' => $variableType.(null !== $defaultValue ? ('|'.$defaultValue) : ''), |
|
1349 | 1349 | '<variableName>' => $variableName, |
1350 | 1350 | '<methodName>' => $methodName, |
1351 | 1351 | '<fieldName>' => $fieldName, |
1352 | - '<variableDefault>' => ($defaultValue !== null ) ? (' = ' . $defaultValue) : '', |
|
1352 | + '<variableDefault>' => ($defaultValue !== null) ? (' = '.$defaultValue) : '', |
|
1353 | 1353 | '<entity>' => $this->getClassName($metadata) |
1354 | 1354 | ]; |
1355 | 1355 | |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | $this->staticReflection[$metadata->getClassName()]['methods'][] = $methodName; |
1378 | 1378 | |
1379 | 1379 | $replacements = [ |
1380 | - '<name>' => $this->annotationsPrefix . ucfirst($name), |
|
1380 | + '<name>' => $this->annotationsPrefix.ucfirst($name), |
|
1381 | 1381 | '<methodName>' => $methodName, |
1382 | 1382 | ]; |
1383 | 1383 | |
@@ -1397,25 +1397,25 @@ discard block |
||
1397 | 1397 | */ |
1398 | 1398 | protected function generateIdentifierAnnotation(Property $metadata) |
1399 | 1399 | { |
1400 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Id'; |
|
1400 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Id'; |
|
1401 | 1401 | |
1402 | 1402 | if ($metadata instanceof FieldMetadata) { |
1403 | 1403 | if ($generatorType = $this->getIdGeneratorTypeString($metadata->getValueGenerator()->getType())) { |
1404 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; |
|
1404 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'GeneratedValue(strategy="'.$generatorType.'")'; |
|
1405 | 1405 | } |
1406 | 1406 | |
1407 | 1407 | if ($metadata->getValueGenerator()->getType()) { |
1408 | 1408 | $generator = []; |
1409 | 1409 | |
1410 | 1410 | if (isset($metadata->getValueGenerator()->getDefinition()['sequenceName'])) { |
1411 | - $generator[] = 'sequenceName="' . $metadata->getValueGenerator()->getDefinition()['sequenceName'] . '"'; |
|
1411 | + $generator[] = 'sequenceName="'.$metadata->getValueGenerator()->getDefinition()['sequenceName'].'"'; |
|
1412 | 1412 | } |
1413 | 1413 | |
1414 | 1414 | if (isset($metadata->getValueGenerator()->getDefinition()['allocationSize'])) { |
1415 | - $generator[] = 'allocationSize=' . $metadata->getValueGenerator()->getDefinition()['allocationSize']; |
|
1415 | + $generator[] = 'allocationSize='.$metadata->getValueGenerator()->getDefinition()['allocationSize']; |
|
1416 | 1416 | } |
1417 | 1417 | |
1418 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'SequenceGenerator(' . implode(', ', $generator) . ')'; |
|
1418 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'SequenceGenerator('.implode(', ', $generator).')'; |
|
1419 | 1419 | } |
1420 | 1420 | } |
1421 | 1421 | |
@@ -1431,34 +1431,34 @@ discard block |
||
1431 | 1431 | { |
1432 | 1432 | $lines = []; |
1433 | 1433 | $joinTableAnnot = []; |
1434 | - $joinTableAnnot[] = 'name="' . $joinTable->getName() . '"'; |
|
1434 | + $joinTableAnnot[] = 'name="'.$joinTable->getName().'"'; |
|
1435 | 1435 | |
1436 | - if (! empty($joinTable->getSchema())) { |
|
1437 | - $joinTableAnnot[] = 'schema="' . $joinTable->getSchema() . '"'; |
|
1436 | + if ( ! empty($joinTable->getSchema())) { |
|
1437 | + $joinTableAnnot[] = 'schema="'.$joinTable->getSchema().'"'; |
|
1438 | 1438 | } |
1439 | 1439 | |
1440 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinTable(' . implode(', ', $joinTableAnnot) . ','; |
|
1441 | - $lines[] = $this->spaces . ' * joinColumns={'; |
|
1440 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinTable('.implode(', ', $joinTableAnnot).','; |
|
1441 | + $lines[] = $this->spaces.' * joinColumns={'; |
|
1442 | 1442 | |
1443 | 1443 | $joinColumnsLines = []; |
1444 | 1444 | |
1445 | 1445 | foreach ($joinTable->getJoinColumns() as $joinColumn) { |
1446 | - $joinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
1446 | + $joinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
1447 | 1447 | } |
1448 | 1448 | |
1449 | - $lines[] = implode(",". PHP_EOL, $joinColumnsLines); |
|
1450 | - $lines[] = $this->spaces . ' * },'; |
|
1451 | - $lines[] = $this->spaces . ' * inverseJoinColumns={'; |
|
1449 | + $lines[] = implode(",".PHP_EOL, $joinColumnsLines); |
|
1450 | + $lines[] = $this->spaces.' * },'; |
|
1451 | + $lines[] = $this->spaces.' * inverseJoinColumns={'; |
|
1452 | 1452 | |
1453 | 1453 | $inverseJoinColumnsLines = []; |
1454 | 1454 | |
1455 | 1455 | foreach ($joinTable->getInverseJoinColumns() as $joinColumn) { |
1456 | - $inverseJoinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
1456 | + $inverseJoinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
1457 | 1457 | } |
1458 | 1458 | |
1459 | - $lines[] = implode(",". PHP_EOL, $inverseJoinColumnsLines); |
|
1460 | - $lines[] = $this->spaces . ' * }'; |
|
1461 | - $lines[] = $this->spaces . ' * )'; |
|
1459 | + $lines[] = implode(",".PHP_EOL, $inverseJoinColumnsLines); |
|
1460 | + $lines[] = $this->spaces.' * }'; |
|
1461 | + $lines[] = $this->spaces.' * )'; |
|
1462 | 1462 | |
1463 | 1463 | return implode(PHP_EOL, $lines); |
1464 | 1464 | } |
@@ -1472,23 +1472,23 @@ discard block |
||
1472 | 1472 | { |
1473 | 1473 | $joinColumnAnnot = []; |
1474 | 1474 | |
1475 | - $joinColumnAnnot[] = 'name="' . $joinColumn->getColumnName() . '"'; |
|
1476 | - $joinColumnAnnot[] = 'referencedColumnName="' . $joinColumn->getReferencedColumnName() . '"'; |
|
1475 | + $joinColumnAnnot[] = 'name="'.$joinColumn->getColumnName().'"'; |
|
1476 | + $joinColumnAnnot[] = 'referencedColumnName="'.$joinColumn->getReferencedColumnName().'"'; |
|
1477 | 1477 | |
1478 | 1478 | if ($joinColumn->isUnique()) { |
1479 | 1479 | $joinColumnAnnot[] = 'unique=true'; |
1480 | 1480 | } |
1481 | 1481 | |
1482 | - if (!$joinColumn->isNullable()) { |
|
1482 | + if ( ! $joinColumn->isNullable()) { |
|
1483 | 1483 | $joinColumnAnnot[] = 'nullable=false'; |
1484 | 1484 | } |
1485 | 1485 | |
1486 | - if (!empty($joinColumn->getOnDelete())) { |
|
1487 | - $joinColumnAnnot[] = 'onDelete="' . $joinColumn->getOnDelete() . '"'; |
|
1486 | + if ( ! empty($joinColumn->getOnDelete())) { |
|
1487 | + $joinColumnAnnot[] = 'onDelete="'.$joinColumn->getOnDelete().'"'; |
|
1488 | 1488 | } |
1489 | 1489 | |
1490 | 1490 | if ($joinColumn->getColumnDefinition()) { |
1491 | - $joinColumnAnnot[] = 'columnDefinition="' . $joinColumn->getColumnDefinition() . '"'; |
|
1491 | + $joinColumnAnnot[] = 'columnDefinition="'.$joinColumn->getColumnDefinition().'"'; |
|
1492 | 1492 | } |
1493 | 1493 | |
1494 | 1494 | $options = []; |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | $joinColumnAnnot[] = 'options={'.implode(',', $options).'}'; |
1504 | 1504 | } |
1505 | 1505 | |
1506 | - return '@' . $this->annotationsPrefix . 'JoinColumn(' . implode(', ', $joinColumnAnnot) . ')'; |
|
1506 | + return '@'.$this->annotationsPrefix.'JoinColumn('.implode(', ', $joinColumnAnnot).')'; |
|
1507 | 1507 | } |
1508 | 1508 | |
1509 | 1509 | /** |
@@ -1515,16 +1515,16 @@ discard block |
||
1515 | 1515 | protected function generateAssociationMappingPropertyDocBlock(AssociationMetadata $association, ClassMetadata $metadata) |
1516 | 1516 | { |
1517 | 1517 | $lines = []; |
1518 | - $lines[] = $this->spaces . '/**'; |
|
1518 | + $lines[] = $this->spaces.'/**'; |
|
1519 | 1519 | |
1520 | 1520 | if ($association instanceof ToManyAssociationMetadata) { |
1521 | - $lines[] = $this->spaces . ' * @var \Doctrine\Common\Collections\Collection'; |
|
1521 | + $lines[] = $this->spaces.' * @var \Doctrine\Common\Collections\Collection'; |
|
1522 | 1522 | } else { |
1523 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($association->getTargetEntity(), '\\'); |
|
1523 | + $lines[] = $this->spaces.' * @var \\'.ltrim($association->getTargetEntity(), '\\'); |
|
1524 | 1524 | } |
1525 | 1525 | |
1526 | 1526 | if ($this->generateAnnotations) { |
1527 | - $lines[] = $this->spaces . ' *'; |
|
1527 | + $lines[] = $this->spaces.' *'; |
|
1528 | 1528 | |
1529 | 1529 | if ($association->isPrimaryKey()) { |
1530 | 1530 | $lines[] = $this->generateIdentifierAnnotation($association); |
@@ -1544,18 +1544,18 @@ discard block |
||
1544 | 1544 | |
1545 | 1545 | $typeOptions = []; |
1546 | 1546 | |
1547 | - $typeOptions[] = 'targetEntity="' . $association->getTargetEntity() . '"'; |
|
1547 | + $typeOptions[] = 'targetEntity="'.$association->getTargetEntity().'"'; |
|
1548 | 1548 | |
1549 | 1549 | if ($association->getMappedBy()) { |
1550 | - $typeOptions[] = 'mappedBy="' . $association->getMappedBy() . '"'; |
|
1550 | + $typeOptions[] = 'mappedBy="'.$association->getMappedBy().'"'; |
|
1551 | 1551 | } |
1552 | 1552 | |
1553 | 1553 | if ($association->getInversedBy()) { |
1554 | - $typeOptions[] = 'inversedBy="' . $association->getInversedBy() . '"'; |
|
1554 | + $typeOptions[] = 'inversedBy="'.$association->getInversedBy().'"'; |
|
1555 | 1555 | } |
1556 | 1556 | |
1557 | 1557 | if ($association instanceof ToManyAssociationMetadata && $association->getIndexedBy()) { |
1558 | - $typeOptions[] = 'indexBy="' . $association->getIndexedBy() . '"'; |
|
1558 | + $typeOptions[] = 'indexBy="'.$association->getIndexedBy().'"'; |
|
1559 | 1559 | } |
1560 | 1560 | |
1561 | 1561 | if ($association->isOrphanRemoval()) { |
@@ -1575,28 +1575,28 @@ discard block |
||
1575 | 1575 | $cascades = ['"all"']; |
1576 | 1576 | } |
1577 | 1577 | |
1578 | - $typeOptions[] = 'cascade={' . implode(',', $cascades) . '}'; |
|
1578 | + $typeOptions[] = 'cascade={'.implode(',', $cascades).'}'; |
|
1579 | 1579 | } |
1580 | 1580 | |
1581 | 1581 | if ($association->getFetchMode() !== FetchMode::LAZY) { |
1582 | - $typeOptions[] = 'fetch="' . $association->getFetchMode() . '"'; |
|
1582 | + $typeOptions[] = 'fetch="'.$association->getFetchMode().'"'; |
|
1583 | 1583 | } |
1584 | 1584 | |
1585 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . '' . $type . '(' . implode(', ', $typeOptions) . ')'; |
|
1585 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.''.$type.'('.implode(', ', $typeOptions).')'; |
|
1586 | 1586 | |
1587 | 1587 | if ($association instanceof ToOneAssociationMetadata && $association->getJoinColumns()) { |
1588 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinColumns({'; |
|
1588 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinColumns({'; |
|
1589 | 1589 | |
1590 | 1590 | $joinColumnsLines = []; |
1591 | 1591 | |
1592 | 1592 | foreach ($association->getJoinColumns() as $joinColumn) { |
1593 | 1593 | if ($joinColumnAnnot = $this->generateJoinColumnAnnotation($joinColumn)) { |
1594 | - $joinColumnsLines[] = $this->spaces . ' * ' . $joinColumnAnnot; |
|
1594 | + $joinColumnsLines[] = $this->spaces.' * '.$joinColumnAnnot; |
|
1595 | 1595 | } |
1596 | 1596 | } |
1597 | 1597 | |
1598 | 1598 | $lines[] = implode(",\n", $joinColumnsLines); |
1599 | - $lines[] = $this->spaces . ' * })'; |
|
1599 | + $lines[] = $this->spaces.' * })'; |
|
1600 | 1600 | } |
1601 | 1601 | |
1602 | 1602 | if ($association instanceof ToManyAssociationMetadata) { |
@@ -1605,20 +1605,20 @@ discard block |
||
1605 | 1605 | } |
1606 | 1606 | |
1607 | 1607 | if ($association->getOrderBy()) { |
1608 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'OrderBy({'; |
|
1608 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'OrderBy({'; |
|
1609 | 1609 | $orderBy = []; |
1610 | 1610 | |
1611 | 1611 | foreach ($association->getOrderBy() as $name => $direction) { |
1612 | - $orderBy[] = $this->spaces . ' * "' . $name . '"="' . $direction . '"'; |
|
1612 | + $orderBy[] = $this->spaces.' * "'.$name.'"="'.$direction.'"'; |
|
1613 | 1613 | } |
1614 | 1614 | |
1615 | - $lines[] = implode(',' . PHP_EOL, $orderBy); |
|
1616 | - $lines[] = $this->spaces . ' * })'; |
|
1615 | + $lines[] = implode(','.PHP_EOL, $orderBy); |
|
1616 | + $lines[] = $this->spaces.' * })'; |
|
1617 | 1617 | } |
1618 | 1618 | } |
1619 | 1619 | } |
1620 | 1620 | |
1621 | - $lines[] = $this->spaces . ' */'; |
|
1621 | + $lines[] = $this->spaces.' */'; |
|
1622 | 1622 | |
1623 | 1623 | return implode("\n", $lines); |
1624 | 1624 | } |
@@ -1635,43 +1635,43 @@ discard block |
||
1635 | 1635 | |
1636 | 1636 | $lines = []; |
1637 | 1637 | |
1638 | - $lines[] = $this->spaces . '/**'; |
|
1639 | - $lines[] = $this->spaces . ' * @var ' |
|
1638 | + $lines[] = $this->spaces.'/**'; |
|
1639 | + $lines[] = $this->spaces.' * @var ' |
|
1640 | 1640 | . $this->getType($fieldType) |
1641 | 1641 | . ($propertyMetadata->isNullable() ? '|null' : ''); |
1642 | 1642 | |
1643 | 1643 | if ($this->generateAnnotations) { |
1644 | 1644 | $column = []; |
1645 | - $lines[] = $this->spaces . ' *'; |
|
1645 | + $lines[] = $this->spaces.' *'; |
|
1646 | 1646 | |
1647 | 1647 | if ($propertyMetadata->getColumnName()) { |
1648 | - $column[] = 'name="' . $propertyMetadata->getColumnName() . '"'; |
|
1648 | + $column[] = 'name="'.$propertyMetadata->getColumnName().'"'; |
|
1649 | 1649 | } |
1650 | 1650 | |
1651 | - $column[] = 'type="' . $fieldType . '"'; |
|
1651 | + $column[] = 'type="'.$fieldType.'"'; |
|
1652 | 1652 | |
1653 | 1653 | if (is_int($propertyMetadata->getLength())) { |
1654 | - $column[] = 'length=' . $propertyMetadata->getLength(); |
|
1654 | + $column[] = 'length='.$propertyMetadata->getLength(); |
|
1655 | 1655 | } |
1656 | 1656 | |
1657 | 1657 | if (is_int($propertyMetadata->getPrecision())) { |
1658 | - $column[] = 'precision=' . $propertyMetadata->getPrecision(); |
|
1658 | + $column[] = 'precision='.$propertyMetadata->getPrecision(); |
|
1659 | 1659 | } |
1660 | 1660 | |
1661 | 1661 | if (is_int($propertyMetadata->getScale())) { |
1662 | - $column[] = 'scale=' . $propertyMetadata->getScale(); |
|
1662 | + $column[] = 'scale='.$propertyMetadata->getScale(); |
|
1663 | 1663 | } |
1664 | 1664 | |
1665 | 1665 | if ($propertyMetadata->isNullable()) { |
1666 | - $column[] = 'nullable=' . var_export($propertyMetadata->isNullable(), true); |
|
1666 | + $column[] = 'nullable='.var_export($propertyMetadata->isNullable(), true); |
|
1667 | 1667 | } |
1668 | 1668 | |
1669 | 1669 | if ($propertyMetadata->isUnique()) { |
1670 | - $column[] = 'unique=' . var_export($propertyMetadata->isUnique(), true); |
|
1670 | + $column[] = 'unique='.var_export($propertyMetadata->isUnique(), true); |
|
1671 | 1671 | } |
1672 | 1672 | |
1673 | 1673 | if ($propertyMetadata->getColumnDefinition()) { |
1674 | - $column[] = 'columnDefinition="' . $propertyMetadata->getColumnDefinition() . '"'; |
|
1674 | + $column[] = 'columnDefinition="'.$propertyMetadata->getColumnDefinition().'"'; |
|
1675 | 1675 | } |
1676 | 1676 | |
1677 | 1677 | $options = []; |
@@ -1686,18 +1686,18 @@ discard block |
||
1686 | 1686 | $column[] = 'options={'.implode(',', $options).'}'; |
1687 | 1687 | } |
1688 | 1688 | |
1689 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Column(' . implode(', ', $column) . ')'; |
|
1689 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Column('.implode(', ', $column).')'; |
|
1690 | 1690 | |
1691 | 1691 | if ($propertyMetadata->isPrimaryKey()) { |
1692 | 1692 | $lines[] = $this->generateIdentifierAnnotation($propertyMetadata); |
1693 | 1693 | } |
1694 | 1694 | |
1695 | 1695 | if ($metadata->isVersioned() && $metadata->versionProperty->getName() === $propertyMetadata->getName()) { |
1696 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Version'; |
|
1696 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Version'; |
|
1697 | 1697 | } |
1698 | 1698 | } |
1699 | 1699 | |
1700 | - $lines[] = $this->spaces . ' */'; |
|
1700 | + $lines[] = $this->spaces.' */'; |
|
1701 | 1701 | |
1702 | 1702 | return implode("\n", $lines); |
1703 | 1703 | } |
@@ -1710,27 +1710,27 @@ discard block |
||
1710 | 1710 | protected function generateEmbeddedPropertyDocBlock(array $embeddedClass) |
1711 | 1711 | { |
1712 | 1712 | $lines = []; |
1713 | - $lines[] = $this->spaces . '/**'; |
|
1714 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($embeddedClass['class'], '\\'); |
|
1713 | + $lines[] = $this->spaces.'/**'; |
|
1714 | + $lines[] = $this->spaces.' * @var \\'.ltrim($embeddedClass['class'], '\\'); |
|
1715 | 1715 | |
1716 | 1716 | if ($this->generateAnnotations) { |
1717 | - $lines[] = $this->spaces . ' *'; |
|
1717 | + $lines[] = $this->spaces.' *'; |
|
1718 | 1718 | |
1719 | - $embedded = ['class="' . $embeddedClass['class'] . '"']; |
|
1719 | + $embedded = ['class="'.$embeddedClass['class'].'"']; |
|
1720 | 1720 | |
1721 | 1721 | if (isset($embeddedClass['columnPrefix'])) { |
1722 | 1722 | if (is_string($embeddedClass['columnPrefix'])) { |
1723 | - $embedded[] = 'columnPrefix="' . $embeddedClass['columnPrefix'] . '"'; |
|
1723 | + $embedded[] = 'columnPrefix="'.$embeddedClass['columnPrefix'].'"'; |
|
1724 | 1724 | } else { |
1725 | - $embedded[] = 'columnPrefix=' . var_export($embeddedClass['columnPrefix'], true); |
|
1725 | + $embedded[] = 'columnPrefix='.var_export($embeddedClass['columnPrefix'], true); |
|
1726 | 1726 | } |
1727 | 1727 | } |
1728 | 1728 | |
1729 | - $lines[] = $this->spaces . ' * @' . |
|
1730 | - $this->annotationsPrefix . 'Embedded(' . implode(', ', $embedded) . ')'; |
|
1729 | + $lines[] = $this->spaces.' * @'. |
|
1730 | + $this->annotationsPrefix.'Embedded('.implode(', ', $embedded).')'; |
|
1731 | 1731 | } |
1732 | 1732 | |
1733 | - $lines[] = $this->spaces . ' */'; |
|
1733 | + $lines[] = $this->spaces.' */'; |
|
1734 | 1734 | |
1735 | 1735 | return implode("\n", $lines); |
1736 | 1736 | } |
@@ -1747,7 +1747,7 @@ discard block |
||
1747 | 1747 | |
1748 | 1748 | foreach ($lines as $key => $value) { |
1749 | 1749 | if ( ! empty($value)) { |
1750 | - $lines[$key] = str_repeat($this->spaces, $num) . $lines[$key]; |
|
1750 | + $lines[$key] = str_repeat($this->spaces, $num).$lines[$key]; |
|
1751 | 1751 | } |
1752 | 1752 | } |
1753 | 1753 | |
@@ -1815,8 +1815,8 @@ discard block |
||
1815 | 1815 | |
1816 | 1816 | foreach ($options as $name => $option) { |
1817 | 1817 | $optionValue = is_array($option) |
1818 | - ? '{' . $this->exportTableOptions($option) . '}' |
|
1819 | - : '"' . (string) $option . '"' |
|
1818 | + ? '{'.$this->exportTableOptions($option).'}' |
|
1819 | + : '"'.(string) $option.'"' |
|
1820 | 1820 | ; |
1821 | 1821 | |
1822 | 1822 | $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();'; |
@@ -24,14 +24,12 @@ |
||
24 | 24 | use Doctrine\ORM\Mapping\AssociationMetadata; |
25 | 25 | use Doctrine\ORM\Mapping\ClassMetadata; |
26 | 26 | use Doctrine\ORM\Mapping\FieldMetadata; |
27 | -use Doctrine\ORM\Mapping\GeneratorType; |
|
28 | 27 | use Doctrine\ORM\Mapping\JoinColumnMetadata; |
29 | 28 | use Doctrine\ORM\Mapping\JoinTableMetadata; |
30 | 29 | use Doctrine\ORM\Mapping\ManyToManyAssociationMetadata; |
31 | 30 | use Doctrine\ORM\Mapping\ManyToOneAssociationMetadata; |
32 | 31 | use Doctrine\ORM\Mapping\OneToManyAssociationMetadata; |
33 | 32 | use Doctrine\ORM\Mapping\OneToOneAssociationMetadata; |
34 | -use Doctrine\ORM\Mapping\ToOneAssociationMetadata; |
|
35 | 33 | |
36 | 34 | /** |
37 | 35 | * ClassMetadata exporter for PHP code. |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * <http://www.doctrine-project.org>. |
18 | 18 | */ |
19 | 19 | |
20 | -declare(strict_types=1); |
|
20 | +declare(strict_types = 1); |
|
21 | 21 | |
22 | 22 | namespace Doctrine\ORM\Tools\Export\Driver; |
23 | 23 | |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | if ($metadata->inheritanceType) { |
68 | - $lines[] = '$metadata->setInheritanceType(Mapping\InheritanceType::' . $metadata->inheritanceType . ');'; |
|
68 | + $lines[] = '$metadata->setInheritanceType(Mapping\InheritanceType::'.$metadata->inheritanceType.');'; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | if ($metadata->getCustomRepositoryClassName()) { |
72 | - $lines[] = '$metadata->setCustomRepositoryClassName("' . $metadata->getCustomRepositoryClassName() . '");'; |
|
72 | + $lines[] = '$metadata->setCustomRepositoryClassName("'.$metadata->getCustomRepositoryClassName().'");'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | if ($metadata->table) { |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | $lines[] = '$table = new Mapping\TableMetadata();'; |
79 | 79 | $lines[] = null; |
80 | 80 | |
81 | - if (! empty($table->getSchema())) { |
|
82 | - $lines[] = '$table->setSchema("' . $table->getSchema() . '");'; |
|
81 | + if ( ! empty($table->getSchema())) { |
|
82 | + $lines[] = '$table->setSchema("'.$table->getSchema().'");'; |
|
83 | 83 | } |
84 | 84 | |
85 | - $lines[] = '$table->setName("' . $table->getName() . '");'; |
|
86 | - $lines[] = '$table->setOptions(' . $this->varExport($table->getOptions()) . ');'; |
|
85 | + $lines[] = '$table->setName("'.$table->getName().'");'; |
|
86 | + $lines[] = '$table->setOptions('.$this->varExport($table->getOptions()).');'; |
|
87 | 87 | |
88 | 88 | foreach ($table->getIndexes() as $index) { |
89 | - $lines[] = '$table->addIndex(' . $this->varExport($index) . ');'; |
|
89 | + $lines[] = '$table->addIndex('.$this->varExport($index).');'; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | foreach ($table->getUniqueConstraints() as $constraint) { |
93 | - $lines[] = '$table->addUniqueConstraint(' . $this->varExport($constraint) . ');'; |
|
93 | + $lines[] = '$table->addUniqueConstraint('.$this->varExport($constraint).');'; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $lines[] = null; |
@@ -102,45 +102,45 @@ discard block |
||
102 | 102 | |
103 | 103 | $lines[] = '$discrColumn = new Mapping\DiscriminatorColumnMetadata();'; |
104 | 104 | $lines[] = null; |
105 | - $lines[] = '$discrColumn->setColumnName("' . $discrColumn->getColumnName() . '");'; |
|
106 | - $lines[] = '$discrColumn->setType(Type::getType("' . $discrColumn->getTypeName() . '"));'; |
|
107 | - $lines[] = '$discrColumn->setTableName("' . $discrColumn->getTableName() . '");'; |
|
105 | + $lines[] = '$discrColumn->setColumnName("'.$discrColumn->getColumnName().'");'; |
|
106 | + $lines[] = '$discrColumn->setType(Type::getType("'.$discrColumn->getTypeName().'"));'; |
|
107 | + $lines[] = '$discrColumn->setTableName("'.$discrColumn->getTableName().'");'; |
|
108 | 108 | |
109 | - if (! empty($discrColumn->getColumnDefinition())) { |
|
110 | - $lines[] = '$property->setColumnDefinition("' . $discrColumn->getColumnDefinition() . '");'; |
|
109 | + if ( ! empty($discrColumn->getColumnDefinition())) { |
|
110 | + $lines[] = '$property->setColumnDefinition("'.$discrColumn->getColumnDefinition().'");'; |
|
111 | 111 | } |
112 | 112 | |
113 | - if (! empty($discrColumn->getLength())) { |
|
114 | - $lines[] = '$property->setLength(' . $discrColumn->getLength() . ');'; |
|
113 | + if ( ! empty($discrColumn->getLength())) { |
|
114 | + $lines[] = '$property->setLength('.$discrColumn->getLength().');'; |
|
115 | 115 | } |
116 | 116 | |
117 | - if (! empty($discrColumn->getScale())) { |
|
118 | - $lines[] = '$property->setScale(' . $discrColumn->getScale() . ');'; |
|
117 | + if ( ! empty($discrColumn->getScale())) { |
|
118 | + $lines[] = '$property->setScale('.$discrColumn->getScale().');'; |
|
119 | 119 | } |
120 | 120 | |
121 | - if (! empty($discrColumn->getPrecision())) { |
|
122 | - $lines[] = '$property->setPrecision(' . $discrColumn->getPrecision() . ');'; |
|
121 | + if ( ! empty($discrColumn->getPrecision())) { |
|
122 | + $lines[] = '$property->setPrecision('.$discrColumn->getPrecision().');'; |
|
123 | 123 | } |
124 | 124 | |
125 | - $lines[] = '$discrColumn->setOptions(' . $this->varExport($discrColumn->getOptions()) . ');'; |
|
126 | - $lines[] = '$discrColumn->setNullable(' . $this->varExport($discrColumn->isNullable()) . ');'; |
|
127 | - $lines[] = '$discrColumn->setUnique(' . $this->varExport($discrColumn->isUnique()) . ');'; |
|
125 | + $lines[] = '$discrColumn->setOptions('.$this->varExport($discrColumn->getOptions()).');'; |
|
126 | + $lines[] = '$discrColumn->setNullable('.$this->varExport($discrColumn->isNullable()).');'; |
|
127 | + $lines[] = '$discrColumn->setUnique('.$this->varExport($discrColumn->isUnique()).');'; |
|
128 | 128 | $lines[] = null; |
129 | 129 | $lines[] = '$metadata->setDiscriminatorColumn($discrColumn);'; |
130 | 130 | } |
131 | 131 | |
132 | 132 | if ($metadata->discriminatorMap) { |
133 | - $lines[] = '$metadata->setDiscriminatorMap(' . $this->varExport($metadata->discriminatorMap) . ');'; |
|
133 | + $lines[] = '$metadata->setDiscriminatorMap('.$this->varExport($metadata->discriminatorMap).');'; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | if ($metadata->changeTrackingPolicy) { |
137 | - $lines[] = '$metadata->setChangeTrackingPolicy(Mapping\ChangeTrackingPolicy::' . $metadata->changeTrackingPolicy . ');'; |
|
137 | + $lines[] = '$metadata->setChangeTrackingPolicy(Mapping\ChangeTrackingPolicy::'.$metadata->changeTrackingPolicy.');'; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | if ($metadata->lifecycleCallbacks) { |
141 | 141 | foreach ($metadata->lifecycleCallbacks as $event => $callbacks) { |
142 | 142 | foreach ($callbacks as $callback) { |
143 | - $lines[] = '$metadata->addLifecycleCallback("' . $callback . '", "' . $event . '");'; |
|
143 | + $lines[] = '$metadata->addLifecycleCallback("'.$callback.'", "'.$event.'");'; |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | } |
@@ -165,30 +165,30 @@ discard block |
||
165 | 165 | ); |
166 | 166 | |
167 | 167 | $lines[] = null; |
168 | - $lines[] = '$property->setColumnName("' . $property->getColumnName() . '");'; |
|
169 | - $lines[] = '$property->setType(Type::getType("' . $property->getTypeName() . '"));'; |
|
170 | - $lines[] = '$property->setTableName("' . $property->getTableName() . '");'; |
|
168 | + $lines[] = '$property->setColumnName("'.$property->getColumnName().'");'; |
|
169 | + $lines[] = '$property->setType(Type::getType("'.$property->getTypeName().'"));'; |
|
170 | + $lines[] = '$property->setTableName("'.$property->getTableName().'");'; |
|
171 | 171 | |
172 | - if (! empty($property->getColumnDefinition())) { |
|
173 | - $lines[] = '$property->setColumnDefinition("' . $property->getColumnDefinition() . '");'; |
|
172 | + if ( ! empty($property->getColumnDefinition())) { |
|
173 | + $lines[] = '$property->setColumnDefinition("'.$property->getColumnDefinition().'");'; |
|
174 | 174 | } |
175 | 175 | |
176 | - if (! empty($property->getLength())) { |
|
177 | - $lines[] = '$property->setLength(' . $property->getLength() . ');'; |
|
176 | + if ( ! empty($property->getLength())) { |
|
177 | + $lines[] = '$property->setLength('.$property->getLength().');'; |
|
178 | 178 | } |
179 | 179 | |
180 | - if (! empty($property->getScale())) { |
|
181 | - $lines[] = '$property->setScale(' . $property->getScale() . ');'; |
|
180 | + if ( ! empty($property->getScale())) { |
|
181 | + $lines[] = '$property->setScale('.$property->getScale().');'; |
|
182 | 182 | } |
183 | 183 | |
184 | - if (! empty($property->getPrecision())) { |
|
185 | - $lines[] = '$property->setPrecision(' . $property->getPrecision() . ');'; |
|
184 | + if ( ! empty($property->getPrecision())) { |
|
185 | + $lines[] = '$property->setPrecision('.$property->getPrecision().');'; |
|
186 | 186 | } |
187 | 187 | |
188 | - $lines[] = '$property->setOptions(' . $this->varExport($property->getOptions()) . ');'; |
|
189 | - $lines[] = '$property->setPrimaryKey(' . $this->varExport($property->isPrimaryKey()) . ');'; |
|
190 | - $lines[] = '$property->setNullable(' . $this->varExport($property->isNullable()) . ');'; |
|
191 | - $lines[] = '$property->setUnique(' . $this->varExport($property->isUnique()) . ');'; |
|
188 | + $lines[] = '$property->setOptions('.$this->varExport($property->getOptions()).');'; |
|
189 | + $lines[] = '$property->setPrimaryKey('.$this->varExport($property->isPrimaryKey()).');'; |
|
190 | + $lines[] = '$property->setNullable('.$this->varExport($property->isNullable()).');'; |
|
191 | + $lines[] = '$property->setUnique('.$this->varExport($property->isUnique()).');'; |
|
192 | 192 | |
193 | 193 | if ($property->hasValueGenerator()) { |
194 | 194 | $lines[] = sprintf( |
@@ -219,25 +219,25 @@ discard block |
||
219 | 219 | if ($association instanceof OneToOneAssociationMetadata) { |
220 | 220 | $this->exportJoinColumns($association->getJoinColumns(), $lines, 'joinColumns'); |
221 | 221 | |
222 | - $lines[] = '$association = new Mapping\OneToOneAssociationMetadata("' . $association->getName() . '");'; |
|
222 | + $lines[] = '$association = new Mapping\OneToOneAssociationMetadata("'.$association->getName().'");'; |
|
223 | 223 | $lines[] = null; |
224 | 224 | $lines[] = '$association->setJoinColumns($joinColumns);'; |
225 | 225 | } else if ($association instanceof ManyToOneAssociationMetadata) { |
226 | 226 | $this->exportJoinColumns($association->getJoinColumns(), $lines, 'joinColumns'); |
227 | 227 | |
228 | - $lines[] = '$association = new Mapping\ManyToOneAssociationMetadata("' . $association->getName() . '");'; |
|
228 | + $lines[] = '$association = new Mapping\ManyToOneAssociationMetadata("'.$association->getName().'");'; |
|
229 | 229 | $lines[] = null; |
230 | 230 | $lines[] = '$association->setJoinColumns($joinColumns);'; |
231 | 231 | } else if ($association instanceof OneToManyAssociationMetadata) { |
232 | - $lines[] = '$association = new Mapping\OneToManyAssociationMetadata("' . $association->getName() . '");'; |
|
232 | + $lines[] = '$association = new Mapping\OneToManyAssociationMetadata("'.$association->getName().'");'; |
|
233 | 233 | $lines[] = null; |
234 | - $lines[] = '$association->setOrderBy(' . $this->varExport($association->getOrderBy()) . ');'; |
|
234 | + $lines[] = '$association->setOrderBy('.$this->varExport($association->getOrderBy()).');'; |
|
235 | 235 | } else if ($association instanceof ManyToManyAssociationMetadata) { |
236 | 236 | if ($association->getJoinTable()) { |
237 | 237 | $this->exportJoinTable($association->getJoinTable(), $lines); |
238 | 238 | } |
239 | 239 | |
240 | - $lines[] = '$association = new Mapping\ManyToManyAssociationMetadata("' . $association->getName() . '");'; |
|
240 | + $lines[] = '$association = new Mapping\ManyToManyAssociationMetadata("'.$association->getName().'");'; |
|
241 | 241 | $lines[] = null; |
242 | 242 | |
243 | 243 | if ($association->getJoinTable()) { |
@@ -245,26 +245,26 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | if ($association->getIndexedBy()) { |
248 | - $lines[] = '$association->setIndexedBy("' . $association->getIndexedBy() . '");'; |
|
248 | + $lines[] = '$association->setIndexedBy("'.$association->getIndexedBy().'");'; |
|
249 | 249 | } |
250 | 250 | |
251 | - $lines[] = '$association->setOrderBy(' . $this->varExport($association->getOrderBy()) . ');'; |
|
251 | + $lines[] = '$association->setOrderBy('.$this->varExport($association->getOrderBy()).');'; |
|
252 | 252 | } |
253 | 253 | |
254 | - $lines[] = '$association->setTargetEntity("' . $association->getTargetEntity() . '");'; |
|
255 | - $lines[] = '$association->setFetchMode("' . $association->getFetchMode() . '");'; |
|
254 | + $lines[] = '$association->setTargetEntity("'.$association->getTargetEntity().'");'; |
|
255 | + $lines[] = '$association->setFetchMode("'.$association->getFetchMode().'");'; |
|
256 | 256 | |
257 | 257 | if ($association->getMappedBy()) { |
258 | - $lines[] = '$association->setMappedBy("' . $association->getMappedBy() . '");'; |
|
258 | + $lines[] = '$association->setMappedBy("'.$association->getMappedBy().'");'; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | if ($association->getInversedBy()) { |
262 | - $lines[] = '$association->setInversedBy("' . $association->getInversedBy() . '");'; |
|
262 | + $lines[] = '$association->setInversedBy("'.$association->getInversedBy().'");'; |
|
263 | 263 | } |
264 | 264 | |
265 | - $lines[] = '$association->setCascade(' . $this->varExport($cascade) . ');'; |
|
266 | - $lines[] = '$association->setOrphanRemoval(' . $this->varExport($association->isOrphanRemoval()) . ');'; |
|
267 | - $lines[] = '$association->setPrimaryKey(' . $this->varExport($association->isPrimaryKey()) . ');'; |
|
265 | + $lines[] = '$association->setCascade('.$this->varExport($cascade).');'; |
|
266 | + $lines[] = '$association->setOrphanRemoval('.$this->varExport($association->isOrphanRemoval()).');'; |
|
267 | + $lines[] = '$association->setPrimaryKey('.$this->varExport($association->isPrimaryKey()).');'; |
|
268 | 268 | $lines[] = null; |
269 | 269 | $lines[] = '$metadata->addProperty($association);'; |
270 | 270 | } |
@@ -274,13 +274,13 @@ discard block |
||
274 | 274 | $lines[] = null; |
275 | 275 | $lines[] = '$joinTable = new Mapping\JoinTableMetadata();'; |
276 | 276 | $lines[] = null; |
277 | - $lines[] = '$joinTable->setName("' . $joinTable->getName() . '");'; |
|
277 | + $lines[] = '$joinTable->setName("'.$joinTable->getName().'");'; |
|
278 | 278 | |
279 | - if (! empty($joinTable->getSchema())) { |
|
280 | - $lines[] = '$joinTable->setSchema("' . $joinTable->getSchema() . '");'; |
|
279 | + if ( ! empty($joinTable->getSchema())) { |
|
280 | + $lines[] = '$joinTable->setSchema("'.$joinTable->getSchema().'");'; |
|
281 | 281 | } |
282 | 282 | |
283 | - $lines[] = '$joinTable->setOptions(' . $this->varExport($joinTable->getOptions()) . ');'; |
|
283 | + $lines[] = '$joinTable->setOptions('.$this->varExport($joinTable->getOptions()).');'; |
|
284 | 284 | |
285 | 285 | $this->exportJoinColumns($joinTable->getJoinColumns(), $lines, 'joinColumns'); |
286 | 286 | |
@@ -300,24 +300,24 @@ discard block |
||
300 | 300 | |
301 | 301 | private function exportJoinColumns(array $joinColumns, array &$lines, $variableName) |
302 | 302 | { |
303 | - $lines[] = '$' . $variableName . ' = array();'; |
|
303 | + $lines[] = '$'.$variableName.' = array();'; |
|
304 | 304 | |
305 | 305 | foreach ($joinColumns as $joinColumn) { |
306 | 306 | /** @var JoinColumnMetadata $joinColumn */ |
307 | 307 | $lines[] = '$joinColumn = new Mapping\JoinColumnMetadata();'; |
308 | 308 | $lines[] = null; |
309 | - $lines[] = '$joinColumn->setTableName("' . $joinColumn->getTableName() . '");'; |
|
310 | - $lines[] = '$joinColumn->setColumnName("' . $joinColumn->getColumnName() . '");'; |
|
311 | - $lines[] = '$joinColumn->setReferencedColumnName("' . $joinColumn->getReferencedColumnName() . '");'; |
|
312 | - $lines[] = '$joinColumn->setAliasedName("' . $joinColumn->getAliasedName() . '");'; |
|
313 | - $lines[] = '$joinColumn->setColumnDefinition("' . $joinColumn->getColumnDefinition() . '");'; |
|
314 | - $lines[] = '$joinColumn->setOnDelete("' . $joinColumn->getOnDelete() . '");'; |
|
315 | - $lines[] = '$joinColumn->setOptions(' . $this->varExport($joinColumn->getOptions()) . ');'; |
|
316 | - $lines[] = '$joinColumn->setNullable("' . $joinColumn->isNullable() . '");'; |
|
317 | - $lines[] = '$joinColumn->setUnique("' . $joinColumn->isUnique() . '");'; |
|
318 | - $lines[] = '$joinColumn->setPrimaryKey("' . $joinColumn->isPrimaryKey() . '");'; |
|
309 | + $lines[] = '$joinColumn->setTableName("'.$joinColumn->getTableName().'");'; |
|
310 | + $lines[] = '$joinColumn->setColumnName("'.$joinColumn->getColumnName().'");'; |
|
311 | + $lines[] = '$joinColumn->setReferencedColumnName("'.$joinColumn->getReferencedColumnName().'");'; |
|
312 | + $lines[] = '$joinColumn->setAliasedName("'.$joinColumn->getAliasedName().'");'; |
|
313 | + $lines[] = '$joinColumn->setColumnDefinition("'.$joinColumn->getColumnDefinition().'");'; |
|
314 | + $lines[] = '$joinColumn->setOnDelete("'.$joinColumn->getOnDelete().'");'; |
|
315 | + $lines[] = '$joinColumn->setOptions('.$this->varExport($joinColumn->getOptions()).');'; |
|
316 | + $lines[] = '$joinColumn->setNullable("'.$joinColumn->isNullable().'");'; |
|
317 | + $lines[] = '$joinColumn->setUnique("'.$joinColumn->isUnique().'");'; |
|
318 | + $lines[] = '$joinColumn->setPrimaryKey("'.$joinColumn->isPrimaryKey().'");'; |
|
319 | 319 | $lines[] = null; |
320 | - $lines[] = '$' . $variableName . '[] = $joinColumn;'; |
|
320 | + $lines[] = '$'.$variableName.'[] = $joinColumn;'; |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | protected function varExport($var) |
330 | 330 | { |
331 | 331 | $export = var_export($var, true); |
332 | - $export = str_replace("\n", PHP_EOL . str_repeat(' ', 8), $export); |
|
332 | + $export = str_replace("\n", PHP_EOL.str_repeat(' ', 8), $export); |
|
333 | 333 | $export = str_replace(' ', ' ', $export); |
334 | 334 | $export = str_replace('array (', 'array(', $export); |
335 | 335 | $export = str_replace('array( ', 'array(', $export); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | /** |
388 | 388 | * @param \SimpleXMLElement $associationXml |
389 | - * @param array $joinColumns |
|
389 | + * @param JoinColumnMetadata[] $joinColumns |
|
390 | 390 | * @param string $joinColumnsName |
391 | 391 | */ |
392 | 392 | private function exportJoinColumns( |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | |
439 | 439 | /** |
440 | 440 | * @param \SimpleXMLElement $associationXml |
441 | - * @param array $associationCascades |
|
441 | + * @param string[] $associationCascades |
|
442 | 442 | */ |
443 | 443 | private function exportCascade(\SimpleXMLElement $associationXml, array $associationCascades) |
444 | 444 | { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * <http://www.doctrine-project.org>. |
18 | 18 | */ |
19 | 19 | |
20 | -declare(strict_types=1); |
|
20 | +declare(strict_types = 1); |
|
21 | 21 | |
22 | 22 | namespace Doctrine\ORM\Tools\Export\Driver; |
23 | 23 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function exportClassMetadata(ClassMetadata $metadata) |
56 | 56 | { |
57 | 57 | $xml = new \SimpleXmlElement("<?xml version=\"1.0\" encoding=\"utf-8\"?><doctrine-mapping ". |
58 | - "xmlns=\"http://doctrine-project.org/schemas/orm/doctrine-mapping\" " . |
|
58 | + "xmlns=\"http://doctrine-project.org/schemas/orm/doctrine-mapping\" ". |
|
59 | 59 | "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ". |
60 | 60 | "xsi:schemaLocation=\"http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd\" />"); |
61 | 61 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
243 | - if (isset($metadata->lifecycleCallbacks) && count($metadata->lifecycleCallbacks)>0) { |
|
243 | + if (isset($metadata->lifecycleCallbacks) && count($metadata->lifecycleCallbacks) > 0) { |
|
244 | 244 | $lifecycleCallbacksXml = $root->addChild('lifecycle-callbacks'); |
245 | 245 | |
246 | 246 | foreach ($metadata->lifecycleCallbacks as $name => $methods) { |
@@ -404,15 +404,15 @@ discard block |
||
404 | 404 | $joinColumnXml->addAttribute('name', $joinColumn->getColumnName()); |
405 | 405 | $joinColumnXml->addAttribute('referenced-column-name', $joinColumn->getReferencedColumnName()); |
406 | 406 | |
407 | - if (! empty($joinColumn->getAliasedName())) { |
|
407 | + if ( ! empty($joinColumn->getAliasedName())) { |
|
408 | 408 | $joinColumnXml->addAttribute('field-name', $joinColumn->getAliasedName()); |
409 | 409 | } |
410 | 410 | |
411 | - if (! empty($joinColumn->getOnDelete())) { |
|
411 | + if ( ! empty($joinColumn->getOnDelete())) { |
|
412 | 412 | $joinColumnXml->addAttribute('on-delete', $joinColumn->getOnDelete()); |
413 | 413 | } |
414 | 414 | |
415 | - if (! empty($joinColumn->getColumnDefinition())) { |
|
415 | + if ( ! empty($joinColumn->getColumnDefinition())) { |
|
416 | 416 | $joinColumnXml->addAttribute('column-definition', $joinColumn->getColumnDefinition()); |
417 | 417 | } |
418 | 418 | |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | |
447 | 447 | foreach (['remove', 'persist', 'refresh', 'merge', 'detach'] as $type) { |
448 | 448 | if (in_array($type, $associationCascades)) { |
449 | - $cascades[] = 'cascade-' . $type; |
|
449 | + $cascades[] = 'cascade-'.$type; |
|
450 | 450 | } |
451 | 451 | } |
452 | 452 | |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | { |
498 | 498 | $sequenceDefinition = $metadata->getValueGenerator()->getDefinition(); |
499 | 499 | |
500 | - if (! ($metadata->getValueGenerator()->getType() === GeneratorType::SEQUENCE && $sequenceDefinition)) { |
|
500 | + if ( ! ($metadata->getValueGenerator()->getType() === GeneratorType::SEQUENCE && $sequenceDefinition)) { |
|
501 | 501 | return; |
502 | 502 | } |
503 | 503 |