@@ -12,11 +12,11 @@ |
||
| 12 | 12 | use Entities\Address; |
| 13 | 13 | use Entities\User; |
| 14 | 14 | |
| 15 | -$em = require_once __DIR__ . '/bootstrap.php'; |
|
| 15 | +$em = require_once __DIR__.'/bootstrap.php'; |
|
| 16 | 16 | |
| 17 | 17 | ## PUT YOUR TEST CODE BELOW |
| 18 | 18 | |
| 19 | 19 | $user = new User; |
| 20 | 20 | $address = new Address; |
| 21 | 21 | |
| 22 | -echo 'Hello World!' . PHP_EOL; |
|
| 22 | +echo 'Hello World!'.PHP_EOL; |
|
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | public function generate(EntityManager $em, $entity) |
| 36 | 36 | { |
| 37 | 37 | $conn = $em->getConnection(); |
| 38 | - $sql = 'SELECT ' . $conn->getDatabasePlatform()->getGuidExpression(); |
|
| 38 | + $sql = 'SELECT '.$conn->getDatabasePlatform()->getGuidExpression(); |
|
| 39 | 39 | |
| 40 | 40 | return $conn->query($sql)->fetchColumn(0); |
| 41 | 41 | } |
@@ -95,15 +95,15 @@ |
||
| 95 | 95 | $expressionList[] = $this->dispatch($child); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - switch($expr->getType()) { |
|
| 98 | + switch ($expr->getType()) { |
|
| 99 | 99 | case CompositeExpression::TYPE_AND: |
| 100 | - return '(' . implode(' AND ', $expressionList) . ')'; |
|
| 100 | + return '('.implode(' AND ', $expressionList).')'; |
|
| 101 | 101 | |
| 102 | 102 | case CompositeExpression::TYPE_OR: |
| 103 | - return '(' . implode(' OR ', $expressionList) . ')'; |
|
| 103 | + return '('.implode(' OR ', $expressionList).')'; |
|
| 104 | 104 | |
| 105 | 105 | default: |
| 106 | - throw new \RuntimeException("Unknown composite " . $expr->getType()); |
|
| 106 | + throw new \RuntimeException("Unknown composite ".$expr->getType()); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | static public function matchingAssocationFieldRequiresObject($class, $associationName) |
| 30 | 30 | { |
| 31 | 31 | return new self(sprintf( |
| 32 | - "Cannot match on %s::%s with a non-object value. Matching objects by id is " . |
|
| 32 | + "Cannot match on %s::%s with a non-object value. Matching objects by id is ". |
|
| 33 | 33 | "not compatible with matching on an in-memory collection, which compares objects by reference.", |
| 34 | 34 | $class, $associationName |
| 35 | 35 | )); |
@@ -147,9 +147,9 @@ |
||
| 147 | 147 | return (bool) $persister->count($criteria); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - /** |
|
| 151 | - * {@inheritdoc} |
|
| 152 | - */ |
|
| 150 | + /** |
|
| 151 | + * {@inheritdoc} |
|
| 152 | + */ |
|
| 153 | 153 | public function contains(PersistentCollection $collection, $element) |
| 154 | 154 | { |
| 155 | 155 | if ( ! $this->isValidEntityState($element)) { |
@@ -217,8 +217,8 @@ discard block |
||
| 217 | 217 | $parameters[] = $identifier[$sourceClass->getFieldForColumn($joinColumn['referencedColumnName'])]; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - $statement = 'DELETE FROM ' . $this->quoteStrategy->getTableName($targetClass, $this->platform) |
|
| 221 | - . ' WHERE ' . implode(' = ? AND ', $columns) . ' = ?'; |
|
| 220 | + $statement = 'DELETE FROM '.$this->quoteStrategy->getTableName($targetClass, $this->platform) |
|
| 221 | + . ' WHERE '.implode(' = ? AND ', $columns).' = ?'; |
|
| 222 | 222 | |
| 223 | 223 | return $this->conn->executeUpdate($statement, $parameters); |
| 224 | 224 | } |
@@ -255,18 +255,18 @@ discard block |
||
| 255 | 255 | ]; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - $statement = $this->platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable |
|
| 259 | - . ' (' . $this->platform->getColumnDeclarationListSQL($columnDefinitions) . ')'; |
|
| 258 | + $statement = $this->platform->getCreateTemporaryTableSnippetSQL().' '.$tempTable |
|
| 259 | + . ' ('.$this->platform->getColumnDeclarationListSQL($columnDefinitions).')'; |
|
| 260 | 260 | |
| 261 | 261 | $this->conn->executeUpdate($statement); |
| 262 | 262 | |
| 263 | 263 | // 2) Build insert table records into temporary table |
| 264 | 264 | $query = $this->em->createQuery( |
| 265 | - ' SELECT t0.' . implode(', t0.', $rootClass->getIdentifierFieldNames()) |
|
| 266 | - . ' FROM ' . $targetClass->name . ' t0 WHERE t0.' . $mapping['mappedBy'] . ' = :owner' |
|
| 265 | + ' SELECT t0.'.implode(', t0.', $rootClass->getIdentifierFieldNames()) |
|
| 266 | + . ' FROM '.$targetClass->name.' t0 WHERE t0.'.$mapping['mappedBy'].' = :owner' |
|
| 267 | 267 | )->setParameter('owner', $collection->getOwner()); |
| 268 | 268 | |
| 269 | - $statement = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ') ' . $query->getSQL(); |
|
| 269 | + $statement = 'INSERT INTO '.$tempTable.' ('.$idColumnList.') '.$query->getSQL(); |
|
| 270 | 270 | $parameters = array_values($sourceClass->getIdentifierValues($collection->getOwner())); |
| 271 | 271 | $numDeleted = $this->conn->executeUpdate($statement, $parameters); |
| 272 | 272 | |
@@ -275,8 +275,8 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | foreach (array_reverse($classNames) as $className) { |
| 277 | 277 | $tableName = $this->quoteStrategy->getTableName($this->em->getClassMetadata($className), $this->platform); |
| 278 | - $statement = 'DELETE FROM ' . $tableName . ' WHERE (' . $idColumnList . ')' |
|
| 279 | - . ' IN (SELECT ' . $idColumnList . ' FROM ' . $tempTable . ')'; |
|
| 278 | + $statement = 'DELETE FROM '.$tableName.' WHERE ('.$idColumnList.')' |
|
| 279 | + . ' IN (SELECT '.$idColumnList.' FROM '.$tempTable.')'; |
|
| 280 | 280 | |
| 281 | 281 | $this->conn->executeUpdate($statement); |
| 282 | 282 | } |
@@ -339,8 +339,8 @@ discard block |
||
| 339 | 339 | |
| 340 | 340 | // FIXME: Order with composite keys might not be correct |
| 341 | 341 | $sql = 'SELECT ' . $columnName |
| 342 | - . ' FROM ' . $tableName |
|
| 343 | - . ' WHERE ' . implode(' = ? AND ', $identifier) . ' = ?'; |
|
| 342 | + . ' FROM ' . $tableName |
|
| 343 | + . ' WHERE ' . implode(' = ? AND ', $identifier) . ' = ?'; |
|
| 344 | 344 | |
| 345 | 345 | $flatId = $this->identifierFlattener->flattenIdentifier($versionedClass, $id); |
| 346 | 346 | |
@@ -474,8 +474,8 @@ discard block |
||
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | $sql = 'UPDATE ' . $quotedTableName |
| 477 | - . ' SET ' . implode(', ', $set) |
|
| 478 | - . ' WHERE ' . implode(' = ? AND ', $where) . ' = ?'; |
|
| 477 | + . ' SET ' . implode(', ', $set) |
|
| 478 | + . ' WHERE ' . implode(' = ? AND ', $where) . ' = ?'; |
|
| 479 | 479 | |
| 480 | 480 | $result = $this->conn->executeUpdate($sql, $params, $types); |
| 481 | 481 | |
@@ -1528,9 +1528,9 @@ discard block |
||
| 1528 | 1528 | $lock = $this->getLockTablesSql($lockMode); |
| 1529 | 1529 | $where = ($conditionSql ? ' WHERE ' . $conditionSql : '') . ' '; |
| 1530 | 1530 | $sql = 'SELECT 1 ' |
| 1531 | - . $lock |
|
| 1532 | - . $where |
|
| 1533 | - . $lockSql; |
|
| 1531 | + . $lock |
|
| 1532 | + . $where |
|
| 1533 | + . $lockSql; |
|
| 1534 | 1534 | |
| 1535 | 1535 | list($params, $types) = $this->expandParameters($criteria); |
| 1536 | 1536 | |
@@ -1981,8 +1981,8 @@ discard block |
||
| 1981 | 1981 | $alias = $this->getSQLTableAlias($this->class->name); |
| 1982 | 1982 | |
| 1983 | 1983 | $sql = 'SELECT 1 ' |
| 1984 | - . $this->getLockTablesSql(null) |
|
| 1985 | - . ' WHERE ' . $this->getSelectConditionSQL($criteria); |
|
| 1984 | + . $this->getLockTablesSql(null) |
|
| 1985 | + . ' WHERE ' . $this->getSelectConditionSQL($criteria); |
|
| 1986 | 1986 | |
| 1987 | 1987 | list($params, $types) = $this->expandParameters($criteria); |
| 1988 | 1988 | |
@@ -2012,9 +2012,9 @@ discard block |
||
| 2012 | 2012 | { |
| 2013 | 2013 | // if one of the join columns is nullable, return left join |
| 2014 | 2014 | foreach ($joinColumns as $joinColumn) { |
| 2015 | - if ( ! isset($joinColumn['nullable']) || $joinColumn['nullable']) { |
|
| 2016 | - return 'LEFT JOIN'; |
|
| 2017 | - } |
|
| 2015 | + if ( ! isset($joinColumn['nullable']) || $joinColumn['nullable']) { |
|
| 2016 | + return 'LEFT JOIN'; |
|
| 2017 | + } |
|
| 2018 | 2018 | } |
| 2019 | 2019 | |
| 2020 | 2020 | return 'INNER JOIN'; |
@@ -342,9 +342,9 @@ discard block |
||
| 342 | 342 | $columnName = $this->quoteStrategy->getColumnName($versionField, $versionedClass, $this->platform); |
| 343 | 343 | |
| 344 | 344 | // FIXME: Order with composite keys might not be correct |
| 345 | - $sql = 'SELECT ' . $columnName |
|
| 346 | - . ' FROM ' . $tableName |
|
| 347 | - . ' WHERE ' . implode(' = ? AND ', $identifier) . ' = ?'; |
|
| 345 | + $sql = 'SELECT '.$columnName |
|
| 346 | + . ' FROM '.$tableName |
|
| 347 | + . ' WHERE '.implode(' = ? AND ', $identifier).' = ?'; |
|
| 348 | 348 | |
| 349 | 349 | |
| 350 | 350 | $flatId = $this->identifierFlattener->flattenIdentifier($versionedClass, $id); |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | $params[] = $value; |
| 440 | - $set[] = $column . ' = ' . $placeholder; |
|
| 440 | + $set[] = $column.' = '.$placeholder; |
|
| 441 | 441 | $types[] = $this->columnTypes[$columnName]; |
| 442 | 442 | } |
| 443 | 443 | |
@@ -483,18 +483,18 @@ discard block |
||
| 483 | 483 | case Type::SMALLINT: |
| 484 | 484 | case Type::INTEGER: |
| 485 | 485 | case Type::BIGINT: |
| 486 | - $set[] = $versionColumn . ' = ' . $versionColumn . ' + 1'; |
|
| 486 | + $set[] = $versionColumn.' = '.$versionColumn.' + 1'; |
|
| 487 | 487 | break; |
| 488 | 488 | |
| 489 | 489 | case Type::DATETIME: |
| 490 | - $set[] = $versionColumn . ' = CURRENT_TIMESTAMP'; |
|
| 490 | + $set[] = $versionColumn.' = CURRENT_TIMESTAMP'; |
|
| 491 | 491 | break; |
| 492 | 492 | } |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | - $sql = 'UPDATE ' . $quotedTableName |
|
| 496 | - . ' SET ' . implode(', ', $set) |
|
| 497 | - . ' WHERE ' . implode(' = ? AND ', $where) . ' = ?'; |
|
| 495 | + $sql = 'UPDATE '.$quotedTableName |
|
| 496 | + . ' SET '.implode(', ', $set) |
|
| 497 | + . ' WHERE '.implode(' = ? AND ', $where).' = ?'; |
|
| 498 | 498 | |
| 499 | 499 | $result = $this->conn->executeUpdate($sql, $params, $types); |
| 500 | 500 | |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | |
| 538 | 538 | |
| 539 | 539 | if ($selfReferential) { |
| 540 | - $otherColumns = (! $mapping['isOwningSide']) |
|
| 540 | + $otherColumns = ( ! $mapping['isOwningSide']) |
|
| 541 | 541 | ? $association['joinTable']['joinColumns'] |
| 542 | 542 | : $association['joinTable']['inverseJoinColumns']; |
| 543 | 543 | } |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | $tableName = $this->quoteStrategy->getTableName($class, $this->platform); |
| 576 | 576 | $idColumns = $this->quoteStrategy->getIdentifierColumnNames($class, $this->platform); |
| 577 | 577 | $id = array_combine($idColumns, $identifier); |
| 578 | - $types = array_map(function ($identifier) use ($class, $self) { |
|
| 578 | + $types = array_map(function($identifier) use ($class, $self) { |
|
| 579 | 579 | if (isset($class->fieldMappings[$identifier])) { |
| 580 | 580 | return $class->fieldMappings[$identifier]['type']; |
| 581 | 581 | } |
@@ -1036,7 +1036,7 @@ discard block |
||
| 1036 | 1036 | ); |
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | - $criteria[$quotedJoinTable . '.' . $quotedKeyColumn] = $value; |
|
| 1039 | + $criteria[$quotedJoinTable.'.'.$quotedKeyColumn] = $value; |
|
| 1040 | 1040 | $parameters[] = [ |
| 1041 | 1041 | 'value' => $value, |
| 1042 | 1042 | 'field' => $field, |
@@ -1079,11 +1079,11 @@ discard block |
||
| 1079 | 1079 | |
| 1080 | 1080 | switch ($lockMode) { |
| 1081 | 1081 | case LockMode::PESSIMISTIC_READ: |
| 1082 | - $lockSql = ' ' . $this->platform->getReadLockSQL(); |
|
| 1082 | + $lockSql = ' '.$this->platform->getReadLockSQL(); |
|
| 1083 | 1083 | break; |
| 1084 | 1084 | |
| 1085 | 1085 | case LockMode::PESSIMISTIC_WRITE: |
| 1086 | - $lockSql = ' ' . $this->platform->getWriteLockSQL(); |
|
| 1086 | + $lockSql = ' '.$this->platform->getWriteLockSQL(); |
|
| 1087 | 1087 | break; |
| 1088 | 1088 | } |
| 1089 | 1089 | |
@@ -1094,14 +1094,14 @@ discard block |
||
| 1094 | 1094 | |
| 1095 | 1095 | if ('' !== $filterSql) { |
| 1096 | 1096 | $conditionSql = $conditionSql |
| 1097 | - ? $conditionSql . ' AND ' . $filterSql |
|
| 1097 | + ? $conditionSql.' AND '.$filterSql |
|
| 1098 | 1098 | : $filterSql; |
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | - $select = 'SELECT ' . $columnList; |
|
| 1102 | - $from = ' FROM ' . $tableName . ' '. $tableAlias; |
|
| 1103 | - $join = $this->currentPersisterContext->selectJoinSql . $joinSql; |
|
| 1104 | - $where = ($conditionSql ? ' WHERE ' . $conditionSql : ''); |
|
| 1101 | + $select = 'SELECT '.$columnList; |
|
| 1102 | + $from = ' FROM '.$tableName.' '.$tableAlias; |
|
| 1103 | + $join = $this->currentPersisterContext->selectJoinSql.$joinSql; |
|
| 1104 | + $where = ($conditionSql ? ' WHERE '.$conditionSql : ''); |
|
| 1105 | 1105 | $lock = $this->platform->appendLockHint($from, $lockMode); |
| 1106 | 1106 | $query = $select |
| 1107 | 1107 | . $lock |
@@ -1109,7 +1109,7 @@ discard block |
||
| 1109 | 1109 | . $where |
| 1110 | 1110 | . $orderBySql; |
| 1111 | 1111 | |
| 1112 | - return $this->platform->modifyLimitQuery($query, $limit, $offset) . $lockSql; |
|
| 1112 | + return $this->platform->modifyLimitQuery($query, $limit, $offset).$lockSql; |
|
| 1113 | 1113 | } |
| 1114 | 1114 | |
| 1115 | 1115 | /** |
@@ -1128,13 +1128,13 @@ discard block |
||
| 1128 | 1128 | |
| 1129 | 1129 | if ('' !== $filterSql) { |
| 1130 | 1130 | $conditionSql = $conditionSql |
| 1131 | - ? $conditionSql . ' AND ' . $filterSql |
|
| 1131 | + ? $conditionSql.' AND '.$filterSql |
|
| 1132 | 1132 | : $filterSql; |
| 1133 | 1133 | } |
| 1134 | 1134 | |
| 1135 | 1135 | $sql = 'SELECT COUNT(*) ' |
| 1136 | - . 'FROM ' . $tableName . ' ' . $tableAlias |
|
| 1137 | - . (empty($conditionSql) ? '' : ' WHERE ' . $conditionSql); |
|
| 1136 | + . 'FROM '.$tableName.' '.$tableAlias |
|
| 1137 | + . (empty($conditionSql) ? '' : ' WHERE '.$conditionSql); |
|
| 1138 | 1138 | |
| 1139 | 1139 | return $sql; |
| 1140 | 1140 | } |
@@ -1167,7 +1167,7 @@ discard block |
||
| 1167 | 1167 | : $baseTableAlias; |
| 1168 | 1168 | |
| 1169 | 1169 | $columnName = $this->quoteStrategy->getColumnName($fieldName, $this->class, $this->platform); |
| 1170 | - $orderByList[] = $tableAlias . '.' . $columnName . ' ' . $orientation; |
|
| 1170 | + $orderByList[] = $tableAlias.'.'.$columnName.' '.$orientation; |
|
| 1171 | 1171 | |
| 1172 | 1172 | continue; |
| 1173 | 1173 | } |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | |
| 1185 | 1185 | foreach ($this->class->associationMappings[$fieldName]['joinColumns'] as $joinColumn) { |
| 1186 | 1186 | $columnName = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); |
| 1187 | - $orderByList[] = $tableAlias . '.' . $columnName . ' ' . $orientation; |
|
| 1187 | + $orderByList[] = $tableAlias.'.'.$columnName.' '.$orientation; |
|
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | 1190 | continue; |
@@ -1193,7 +1193,7 @@ discard block |
||
| 1193 | 1193 | throw ORMException::unrecognizedField($fieldName); |
| 1194 | 1194 | } |
| 1195 | 1195 | |
| 1196 | - return ' ORDER BY ' . implode(', ', $orderByList); |
|
| 1196 | + return ' ORDER BY '.implode(', ', $orderByList); |
|
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | /** |
@@ -1221,8 +1221,8 @@ discard block |
||
| 1221 | 1221 | $columnList[] = $this->getSelectColumnSQL($field, $this->class); |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | - $this->currentPersisterContext->selectJoinSql = ''; |
|
| 1225 | - $eagerAliasCounter = 0; |
|
| 1224 | + $this->currentPersisterContext->selectJoinSql = ''; |
|
| 1225 | + $eagerAliasCounter = 0; |
|
| 1226 | 1226 | |
| 1227 | 1227 | foreach ($this->class->associationMappings as $assocField => $assoc) { |
| 1228 | 1228 | $assocColumnSQL = $this->getSelectColumnAssociationSQL($assocField, $assoc, $this->class); |
@@ -1248,7 +1248,7 @@ discard block |
||
| 1248 | 1248 | continue; // now this is why you shouldn't use inheritance |
| 1249 | 1249 | } |
| 1250 | 1250 | |
| 1251 | - $assocAlias = 'e' . ($eagerAliasCounter++); |
|
| 1251 | + $assocAlias = 'e'.($eagerAliasCounter++); |
|
| 1252 | 1252 | $this->currentPersisterContext->rsm->addJoinedEntityResult($assoc['targetEntity'], $assocAlias, 'r', $assocField); |
| 1253 | 1253 | |
| 1254 | 1254 | foreach ($eagerEntity->fieldNames as $field) { |
@@ -1281,14 +1281,14 @@ discard block |
||
| 1281 | 1281 | $joinTableName = $this->quoteStrategy->getTableName($eagerEntity, $this->platform); |
| 1282 | 1282 | |
| 1283 | 1283 | if ($assoc['isOwningSide']) { |
| 1284 | - $tableAlias = $this->getSQLTableAlias($association['targetEntity'], $assocAlias); |
|
| 1285 | - $this->currentPersisterContext->selectJoinSql .= ' ' . $this->getJoinSQLForJoinColumns($association['joinColumns']); |
|
| 1284 | + $tableAlias = $this->getSQLTableAlias($association['targetEntity'], $assocAlias); |
|
| 1285 | + $this->currentPersisterContext->selectJoinSql .= ' '.$this->getJoinSQLForJoinColumns($association['joinColumns']); |
|
| 1286 | 1286 | |
| 1287 | 1287 | foreach ($association['joinColumns'] as $joinColumn) { |
| 1288 | 1288 | $sourceCol = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); |
| 1289 | 1289 | $targetCol = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $this->class, $this->platform); |
| 1290 | 1290 | $joinCondition[] = $this->getSQLTableAlias($association['sourceEntity']) |
| 1291 | - . '.' . $sourceCol . ' = ' . $tableAlias . '.' . $targetCol; |
|
| 1291 | + . '.'.$sourceCol.' = '.$tableAlias.'.'.$targetCol; |
|
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | 1294 | // Add filter SQL |
@@ -1304,12 +1304,12 @@ discard block |
||
| 1304 | 1304 | $sourceCol = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); |
| 1305 | 1305 | $targetCol = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $this->class, $this->platform); |
| 1306 | 1306 | |
| 1307 | - $joinCondition[] = $this->getSQLTableAlias($association['sourceEntity'], $assocAlias) . '.' . $sourceCol . ' = ' |
|
| 1308 | - . $this->getSQLTableAlias($association['targetEntity']) . '.' . $targetCol; |
|
| 1307 | + $joinCondition[] = $this->getSQLTableAlias($association['sourceEntity'], $assocAlias).'.'.$sourceCol.' = ' |
|
| 1308 | + . $this->getSQLTableAlias($association['targetEntity']).'.'.$targetCol; |
|
| 1309 | 1309 | } |
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | - $this->currentPersisterContext->selectJoinSql .= ' ' . $joinTableName . ' ' . $joinTableAlias . ' ON '; |
|
| 1312 | + $this->currentPersisterContext->selectJoinSql .= ' '.$joinTableName.' '.$joinTableAlias.' ON '; |
|
| 1313 | 1313 | $this->currentPersisterContext->selectJoinSql .= implode(' AND ', $joinCondition); |
| 1314 | 1314 | } |
| 1315 | 1315 | |
@@ -1330,7 +1330,7 @@ discard block |
||
| 1330 | 1330 | */ |
| 1331 | 1331 | protected function getSelectColumnAssociationSQL($field, $assoc, ClassMetadata $class, $alias = 'r') |
| 1332 | 1332 | { |
| 1333 | - if ( ! ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE) ) { |
|
| 1333 | + if ( ! ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE)) { |
|
| 1334 | 1334 | return ''; |
| 1335 | 1335 | } |
| 1336 | 1336 | |
@@ -1379,10 +1379,10 @@ discard block |
||
| 1379 | 1379 | foreach ($joinColumns as $joinColumn) { |
| 1380 | 1380 | $quotedSourceColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); |
| 1381 | 1381 | $quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $this->class, $this->platform); |
| 1382 | - $conditions[] = $sourceTableAlias . '.' . $quotedTargetColumn . ' = ' . $joinTableName . '.' . $quotedSourceColumn; |
|
| 1382 | + $conditions[] = $sourceTableAlias.'.'.$quotedTargetColumn.' = '.$joinTableName.'.'.$quotedSourceColumn; |
|
| 1383 | 1383 | } |
| 1384 | 1384 | |
| 1385 | - return ' INNER JOIN ' . $joinTableName . ' ON ' . implode(' AND ', $conditions); |
|
| 1385 | + return ' INNER JOIN '.$joinTableName.' ON '.implode(' AND ', $conditions); |
|
| 1386 | 1386 | } |
| 1387 | 1387 | |
| 1388 | 1388 | /** |
@@ -1461,7 +1461,7 @@ discard block |
||
| 1461 | 1461 | continue; |
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | - if (! $this->class->isIdGeneratorIdentity() || $this->class->identifier[0] != $name) { |
|
| 1464 | + if ( ! $this->class->isIdGeneratorIdentity() || $this->class->identifier[0] != $name) { |
|
| 1465 | 1465 | $columns[] = $this->quoteStrategy->getColumnName($name, $this->class, $this->platform); |
| 1466 | 1466 | $this->columnTypes[$name] = $this->class->fieldMappings[$name]['type']; |
| 1467 | 1467 | } |
@@ -1482,7 +1482,7 @@ discard block |
||
| 1482 | 1482 | */ |
| 1483 | 1483 | protected function getSelectColumnSQL($field, ClassMetadata $class, $alias = 'r') |
| 1484 | 1484 | { |
| 1485 | - $root = $alias == 'r' ? '' : $alias ; |
|
| 1485 | + $root = $alias == 'r' ? '' : $alias; |
|
| 1486 | 1486 | $tableAlias = $this->getSQLTableAlias($class->name, $root); |
| 1487 | 1487 | $fieldMapping = $class->fieldMappings[$field]; |
| 1488 | 1488 | $sql = sprintf('%s.%s', $tableAlias, $this->quoteStrategy->getColumnName($field, $class, $this->platform)); |
@@ -1495,7 +1495,7 @@ discard block |
||
| 1495 | 1495 | $sql = $type->convertToPHPValueSQL($sql, $this->platform); |
| 1496 | 1496 | } |
| 1497 | 1497 | |
| 1498 | - return $sql . ' AS ' . $columnAlias; |
|
| 1498 | + return $sql.' AS '.$columnAlias; |
|
| 1499 | 1499 | } |
| 1500 | 1500 | |
| 1501 | 1501 | /** |
@@ -1511,14 +1511,14 @@ discard block |
||
| 1511 | 1511 | protected function getSQLTableAlias($className, $assocName = '') |
| 1512 | 1512 | { |
| 1513 | 1513 | if ($assocName) { |
| 1514 | - $className .= '#' . $assocName; |
|
| 1514 | + $className .= '#'.$assocName; |
|
| 1515 | 1515 | } |
| 1516 | 1516 | |
| 1517 | 1517 | if (isset($this->currentPersisterContext->sqlTableAliases[$className])) { |
| 1518 | 1518 | return $this->currentPersisterContext->sqlTableAliases[$className]; |
| 1519 | 1519 | } |
| 1520 | 1520 | |
| 1521 | - $tableAlias = 't' . $this->currentPersisterContext->sqlAliasCounter++; |
|
| 1521 | + $tableAlias = 't'.$this->currentPersisterContext->sqlAliasCounter++; |
|
| 1522 | 1522 | |
| 1523 | 1523 | $this->currentPersisterContext->sqlTableAliases[$className] = $tableAlias; |
| 1524 | 1524 | |
@@ -1545,7 +1545,7 @@ discard block |
||
| 1545 | 1545 | } |
| 1546 | 1546 | |
| 1547 | 1547 | $lock = $this->getLockTablesSql($lockMode); |
| 1548 | - $where = ($conditionSql ? ' WHERE ' . $conditionSql : '') . ' '; |
|
| 1548 | + $where = ($conditionSql ? ' WHERE '.$conditionSql : '').' '; |
|
| 1549 | 1549 | $sql = 'SELECT 1 ' |
| 1550 | 1550 | . $lock |
| 1551 | 1551 | . $where |
@@ -1567,7 +1567,7 @@ discard block |
||
| 1567 | 1567 | { |
| 1568 | 1568 | return $this->platform->appendLockHint( |
| 1569 | 1569 | 'FROM ' |
| 1570 | - . $this->quoteStrategy->getTableName($this->class, $this->platform) . ' ' |
|
| 1570 | + . $this->quoteStrategy->getTableName($this->class, $this->platform).' ' |
|
| 1571 | 1571 | . $this->getSQLTableAlias($this->class->name), |
| 1572 | 1572 | $lockMode |
| 1573 | 1573 | ); |
@@ -1612,7 +1612,7 @@ discard block |
||
| 1612 | 1612 | $comparison = $expression->getOperator(); |
| 1613 | 1613 | } |
| 1614 | 1614 | |
| 1615 | - $columns = $this->getSelectConditionStatementColumnSQL($field, $assoc); |
|
| 1615 | + $columns = $this->getSelectConditionStatementColumnSQL($field, $assoc); |
|
| 1616 | 1616 | |
| 1617 | 1617 | if (count($columns) > 1 && $comparison === Comparison::IN) { |
| 1618 | 1618 | /* |
@@ -1632,19 +1632,19 @@ discard block |
||
| 1632 | 1632 | |
| 1633 | 1633 | if (null !== $comparison) { |
| 1634 | 1634 | // special case null value handling |
| 1635 | - if (($comparison === Comparison::EQ || $comparison === Comparison::IS) && null ===$value) { |
|
| 1636 | - $selectedColumns[] = $column . ' IS NULL'; |
|
| 1635 | + if (($comparison === Comparison::EQ || $comparison === Comparison::IS) && null === $value) { |
|
| 1636 | + $selectedColumns[] = $column.' IS NULL'; |
|
| 1637 | 1637 | |
| 1638 | 1638 | continue; |
| 1639 | 1639 | } |
| 1640 | 1640 | |
| 1641 | 1641 | if ($comparison === Comparison::NEQ && null === $value) { |
| 1642 | - $selectedColumns[] = $column . ' IS NOT NULL'; |
|
| 1642 | + $selectedColumns[] = $column.' IS NOT NULL'; |
|
| 1643 | 1643 | |
| 1644 | 1644 | continue; |
| 1645 | 1645 | } |
| 1646 | 1646 | |
| 1647 | - $selectedColumns[] = $column . ' ' . sprintf(self::$comparisonMap[$comparison], $placeholder); |
|
| 1647 | + $selectedColumns[] = $column.' '.sprintf(self::$comparisonMap[$comparison], $placeholder); |
|
| 1648 | 1648 | |
| 1649 | 1649 | continue; |
| 1650 | 1650 | } |
@@ -1692,7 +1692,7 @@ discard block |
||
| 1692 | 1692 | ? $this->class->fieldMappings[$field]['inherited'] |
| 1693 | 1693 | : $this->class->name; |
| 1694 | 1694 | |
| 1695 | - return [$this->getSQLTableAlias($className) . '.' . $this->quoteStrategy->getColumnName($field, $this->class, $this->platform)]; |
|
| 1695 | + return [$this->getSQLTableAlias($className).'.'.$this->quoteStrategy->getColumnName($field, $this->class, $this->platform)]; |
|
| 1696 | 1696 | } |
| 1697 | 1697 | |
| 1698 | 1698 | if (isset($this->class->associationMappings[$field])) { |
@@ -1713,7 +1713,7 @@ discard block |
||
| 1713 | 1713 | |
| 1714 | 1714 | |
| 1715 | 1715 | foreach ($joinColumns as $joinColumn) { |
| 1716 | - $columns[] = $joinTableName . '.' . $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform); |
|
| 1716 | + $columns[] = $joinTableName.'.'.$this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform); |
|
| 1717 | 1717 | } |
| 1718 | 1718 | |
| 1719 | 1719 | } else { |
@@ -1721,12 +1721,12 @@ discard block |
||
| 1721 | 1721 | throw ORMException::invalidFindByInverseAssociation($this->class->name, $field); |
| 1722 | 1722 | } |
| 1723 | 1723 | |
| 1724 | - $className = (isset($association['inherited'])) |
|
| 1724 | + $className = (isset($association['inherited'])) |
|
| 1725 | 1725 | ? $association['inherited'] |
| 1726 | 1726 | : $this->class->name; |
| 1727 | 1727 | |
| 1728 | 1728 | foreach ($association['joinColumns'] as $joinColumn) { |
| 1729 | - $columns[] = $this->getSQLTableAlias($className) . '.' . $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); |
|
| 1729 | + $columns[] = $this->getSQLTableAlias($className).'.'.$this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); |
|
| 1730 | 1730 | } |
| 1731 | 1731 | } |
| 1732 | 1732 | return $columns; |
@@ -1818,7 +1818,7 @@ discard block |
||
| 1818 | 1818 | $value = $value[$this->em->getClassMetadata($sourceClass->associationMappings[$field]['targetEntity'])->identifier[0]]; |
| 1819 | 1819 | } |
| 1820 | 1820 | |
| 1821 | - $criteria[$tableAlias . "." . $targetKeyColumn] = $value; |
|
| 1821 | + $criteria[$tableAlias.".".$targetKeyColumn] = $value; |
|
| 1822 | 1822 | $parameters[] = [ |
| 1823 | 1823 | 'value' => $value, |
| 1824 | 1824 | 'field' => $field, |
@@ -1831,7 +1831,7 @@ discard block |
||
| 1831 | 1831 | $field = $sourceClass->fieldNames[$sourceKeyColumn]; |
| 1832 | 1832 | $value = $sourceClass->reflFields[$field]->getValue($sourceEntity); |
| 1833 | 1833 | |
| 1834 | - $criteria[$tableAlias . "." . $targetKeyColumn] = $value; |
|
| 1834 | + $criteria[$tableAlias.".".$targetKeyColumn] = $value; |
|
| 1835 | 1835 | $parameters[] = [ |
| 1836 | 1836 | 'value' => $value, |
| 1837 | 1837 | 'field' => $field, |
@@ -1919,7 +1919,7 @@ discard block |
||
| 1919 | 1919 | $assoc = $class->associationMappings[$field]; |
| 1920 | 1920 | $class = $this->em->getClassMetadata($assoc['targetEntity']); |
| 1921 | 1921 | |
| 1922 | - if (! $assoc['isOwningSide']) { |
|
| 1922 | + if ( ! $assoc['isOwningSide']) { |
|
| 1923 | 1923 | $assoc = $class->associationMappings[$assoc['mappedBy']]; |
| 1924 | 1924 | $class = $this->em->getClassMetadata($assoc['targetEntity']); |
| 1925 | 1925 | } |
@@ -1928,7 +1928,7 @@ discard block |
||
| 1928 | 1928 | ? $assoc['relationToTargetKeyColumns'] |
| 1929 | 1929 | : $assoc['sourceToTargetKeyColumns']; |
| 1930 | 1930 | |
| 1931 | - foreach ($columns as $column){ |
|
| 1931 | + foreach ($columns as $column) { |
|
| 1932 | 1932 | $types[] = PersisterHelper::getTypeOfColumn($column, $class, $this->em); |
| 1933 | 1933 | } |
| 1934 | 1934 | break; |
@@ -1939,7 +1939,7 @@ discard block |
||
| 1939 | 1939 | } |
| 1940 | 1940 | |
| 1941 | 1941 | if (is_array($value)) { |
| 1942 | - return array_map(function ($type) { |
|
| 1942 | + return array_map(function($type) { |
|
| 1943 | 1943 | $type = Type::getType($type); |
| 1944 | 1944 | |
| 1945 | 1945 | return $type->getBindingType() + Connection::ARRAY_PARAM_OFFSET; |
@@ -2015,12 +2015,12 @@ discard block |
||
| 2015 | 2015 | |
| 2016 | 2016 | $sql = 'SELECT 1 ' |
| 2017 | 2017 | . $this->getLockTablesSql(null) |
| 2018 | - . ' WHERE ' . $this->getSelectConditionSQL($criteria); |
|
| 2018 | + . ' WHERE '.$this->getSelectConditionSQL($criteria); |
|
| 2019 | 2019 | |
| 2020 | 2020 | list($params, $types) = $this->expandParameters($criteria); |
| 2021 | 2021 | |
| 2022 | 2022 | if (null !== $extraConditions) { |
| 2023 | - $sql .= ' AND ' . $this->getSelectConditionCriteriaSQL($extraConditions); |
|
| 2023 | + $sql .= ' AND '.$this->getSelectConditionCriteriaSQL($extraConditions); |
|
| 2024 | 2024 | list($criteriaParams, $criteriaTypes) = $this->expandCriteriaParameters($extraConditions); |
| 2025 | 2025 | |
| 2026 | 2026 | $params = array_merge($params, $criteriaParams); |
@@ -2028,7 +2028,7 @@ discard block |
||
| 2028 | 2028 | } |
| 2029 | 2029 | |
| 2030 | 2030 | if ($filterSql = $this->generateFilterConditionSQL($this->class, $alias)) { |
| 2031 | - $sql .= ' AND ' . $filterSql; |
|
| 2031 | + $sql .= ' AND '.$filterSql; |
|
| 2032 | 2032 | } |
| 2033 | 2033 | |
| 2034 | 2034 | return (bool) $this->conn->fetchColumn($sql, $params, 0, $types); |
@@ -2075,13 +2075,13 @@ discard block |
||
| 2075 | 2075 | |
| 2076 | 2076 | foreach ($this->em->getFilters()->getEnabledFilters() as $filter) { |
| 2077 | 2077 | if ('' !== $filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias)) { |
| 2078 | - $filterClauses[] = '(' . $filterExpr . ')'; |
|
| 2078 | + $filterClauses[] = '('.$filterExpr.')'; |
|
| 2079 | 2079 | } |
| 2080 | 2080 | } |
| 2081 | 2081 | |
| 2082 | 2082 | $sql = implode(' AND ', $filterClauses); |
| 2083 | 2083 | |
| 2084 | - return $sql ? "(" . $sql . ")" : ""; // Wrap again to avoid "X or Y and FilterConditionSQL" |
|
| 2084 | + return $sql ? "(".$sql.")" : ""; // Wrap again to avoid "X or Y and FilterConditionSQL" |
|
| 2085 | 2085 | } |
| 2086 | 2086 | |
| 2087 | 2087 | /** |
@@ -47,17 +47,17 @@ |
||
| 47 | 47 | * Get all queued inserts. |
| 48 | 48 | * |
| 49 | 49 | * @return array |
| 50 | - */ |
|
| 50 | + */ |
|
| 51 | 51 | public function getInserts(); |
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * @TODO - It should not be here. |
|
| 55 | - * But its necessary since JoinedSubclassPersister#executeInserts invoke the root persister. |
|
| 56 | - * |
|
| 57 | - * Gets the INSERT SQL used by the persister to persist a new entity. |
|
| 58 | - * |
|
| 59 | - * @return string |
|
| 60 | - */ |
|
| 53 | + /** |
|
| 54 | + * @TODO - It should not be here. |
|
| 55 | + * But its necessary since JoinedSubclassPersister#executeInserts invoke the root persister. |
|
| 56 | + * |
|
| 57 | + * Gets the INSERT SQL used by the persister to persist a new entity. |
|
| 58 | + * |
|
| 59 | + * @return string |
|
| 60 | + */ |
|
| 61 | 61 | public function getInsertSQL(); |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | $rootClass = $this->em->getClassMetadata($this->class->rootEntityName); |
| 58 | 58 | $tableAlias = $this->getSQLTableAlias($rootClass->name); |
| 59 | 59 | |
| 60 | - // Append discriminator column |
|
| 60 | + // Append discriminator column |
|
| 61 | 61 | $discrColumn = $this->class->discriminatorColumn['name']; |
| 62 | 62 | $discrColumnType = $this->class->discriminatorColumn['type']; |
| 63 | 63 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $discrColumn = $this->class->discriminatorColumn['name']; |
| 62 | 62 | $discrColumnType = $this->class->discriminatorColumn['type']; |
| 63 | 63 | |
| 64 | - $columnList[] = $tableAlias . '.' . $discrColumn; |
|
| 64 | + $columnList[] = $tableAlias.'.'.$discrColumn; |
|
| 65 | 65 | |
| 66 | 66 | $resultColumnName = $this->platform->getSQLResultCasing($discrColumn); |
| 67 | 67 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $conditionSql .= ' AND '; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - return $conditionSql . $this->getSelectConditionDiscriminatorValueSQL(); |
|
| 145 | + return $conditionSql.$this->getSelectConditionDiscriminatorValueSQL(); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $conditionSql .= ' AND '; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - return $conditionSql . $this->getSelectConditionDiscriminatorValueSQL(); |
|
| 159 | + return $conditionSql.$this->getSelectConditionDiscriminatorValueSQL(); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $discColumn = $this->class->discriminatorColumn['name']; |
| 181 | 181 | $tableAlias = $this->getSQLTableAlias($this->class->name); |
| 182 | 182 | |
| 183 | - return $tableAlias . '.' . $discColumn . ' IN (' . $values . ')'; |
|
| 183 | + return $tableAlias.'.'.$discColumn.' IN ('.$values.')'; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -33,6 +33,6 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public static function noDispatchForNode($node) |
| 35 | 35 | { |
| 36 | - return new self("Double-dispatch for node " . get_class($node) . " is not supported."); |
|
| 36 | + return new self("Double-dispatch for node ".get_class($node)." is not supported."); |
|
| 37 | 37 | } |
| 38 | 38 | } |