@@ -5,8 +5,8 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | // Path to composer autoloader. You can use different provided by your favorite framework, |
| 7 | 7 | // if you want to. |
| 8 | -$loaderPath = __DIR__ . '/../../vendor/autoload.php'; |
|
| 9 | -if(!is_readable($loaderPath)){ |
|
| 8 | +$loaderPath = __DIR__.'/../../vendor/autoload.php'; |
|
| 9 | +if ( ! is_readable($loaderPath)) { |
|
| 10 | 10 | throw new LogicException('Run php composer.phar install at first'); |
| 11 | 11 | } |
| 12 | 12 | $loader = require $loaderPath; |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $config = new \Doctrine\ORM\Configuration(); |
| 20 | 20 | |
| 21 | 21 | // Set up Metadata Drivers |
| 22 | -$driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__ . "/Entities")); |
|
| 22 | +$driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__."/Entities")); |
|
| 23 | 23 | $config->setMetadataDriverImpl($driverImpl); |
| 24 | 24 | |
| 25 | 25 | // Set up caches, depending on $debug variable. |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $config->setQueryCacheImpl($cache); |
| 30 | 30 | |
| 31 | 31 | // Proxy configuration |
| 32 | -$config->setProxyDir(__DIR__ . '/Proxies'); |
|
| 32 | +$config->setProxyDir(__DIR__.'/Proxies'); |
|
| 33 | 33 | $config->setProxyNamespace('Proxies'); |
| 34 | 34 | |
| 35 | 35 | // Database connection information |
@@ -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 | } |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | $this->_tableName, $this->_sequenceName, $this->_allocationSize |
| 93 | 93 | ); |
| 94 | 94 | |
| 95 | - if ($conn->executeUpdate($updateSql, array(1 => $currentLevel, 2 => $currentLevel+1)) !== 1) { |
|
| 95 | + if ($conn->executeUpdate($updateSql, array(1 => $currentLevel, 2 => $currentLevel + 1)) !== 1) { |
|
| 96 | 96 | // no affected rows, concurrency issue, throw exception |
| 97 | 97 | } |
| 98 | 98 | } else { |
@@ -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 | )); |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | $parameters[] = $identifier[$sourceClass->getFieldForColumn($joinColumn['referencedColumnName'])]; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - $statement = 'DELETE FROM ' . $this->quoteStrategy->getTableName($targetClass, $this->platform) |
|
| 222 | - . ' WHERE ' . implode(' = ? AND ', $columns) . ' = ?'; |
|
| 221 | + $statement = 'DELETE FROM '.$this->quoteStrategy->getTableName($targetClass, $this->platform) |
|
| 222 | + . ' WHERE '.implode(' = ? AND ', $columns).' = ?'; |
|
| 223 | 223 | |
| 224 | 224 | return $this->conn->executeUpdate($statement, $parameters); |
| 225 | 225 | } |
@@ -256,18 +256,18 @@ discard block |
||
| 256 | 256 | ); |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - $statement = $this->platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable |
|
| 260 | - . ' (' . $this->platform->getColumnDeclarationListSQL($columnDefinitions) . ')'; |
|
| 259 | + $statement = $this->platform->getCreateTemporaryTableSnippetSQL().' '.$tempTable |
|
| 260 | + . ' ('.$this->platform->getColumnDeclarationListSQL($columnDefinitions).')'; |
|
| 261 | 261 | |
| 262 | 262 | $this->conn->executeUpdate($statement); |
| 263 | 263 | |
| 264 | 264 | // 2) Build insert table records into temporary table |
| 265 | 265 | $query = $this->em->createQuery( |
| 266 | - ' SELECT t0.' . implode(', t0.', $rootClass->getIdentifierFieldNames()) |
|
| 267 | - . ' FROM ' . $targetClass->name . ' t0 WHERE t0.' . $mapping['mappedBy'] . ' = :owner' |
|
| 266 | + ' SELECT t0.'.implode(', t0.', $rootClass->getIdentifierFieldNames()) |
|
| 267 | + . ' FROM '.$targetClass->name.' t0 WHERE t0.'.$mapping['mappedBy'].' = :owner' |
|
| 268 | 268 | )->setParameter('owner', $collection->getOwner()); |
| 269 | 269 | |
| 270 | - $statement = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ') ' . $query->getSQL(); |
|
| 270 | + $statement = 'INSERT INTO '.$tempTable.' ('.$idColumnList.') '.$query->getSQL(); |
|
| 271 | 271 | $parameters = array_values($sourceClass->getIdentifierValues($collection->getOwner())); |
| 272 | 272 | $numDeleted = $this->conn->executeUpdate($statement, $parameters); |
| 273 | 273 | |
@@ -276,8 +276,8 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | foreach (array_reverse($classNames) as $className) { |
| 278 | 278 | $tableName = $this->quoteStrategy->getTableName($this->em->getClassMetadata($className), $this->platform); |
| 279 | - $statement = 'DELETE FROM ' . $tableName . ' WHERE (' . $idColumnList . ')' |
|
| 280 | - . ' IN (SELECT ' . $idColumnList . ' FROM ' . $tempTable . ')'; |
|
| 279 | + $statement = 'DELETE FROM '.$tableName.' WHERE ('.$idColumnList.')' |
|
| 280 | + . ' IN (SELECT '.$idColumnList.' FROM '.$tempTable.')'; |
|
| 281 | 281 | |
| 282 | 282 | $this->conn->executeUpdate($statement); |
| 283 | 283 | } |
@@ -715,9 +715,9 @@ |
||
| 715 | 715 | ); |
| 716 | 716 | } |
| 717 | 717 | |
| 718 | - /** |
|
| 719 | - * {@inheritdoc} |
|
| 720 | - */ |
|
| 718 | + /** |
|
| 719 | + * {@inheritdoc} |
|
| 720 | + */ |
|
| 721 | 721 | protected function getHash() |
| 722 | 722 | { |
| 723 | 723 | return sha1(parent::getHash(). '-'. $this->_firstResult . '-' . $this->_maxResults); |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | /** |
| 40 | 40 | * @var array |
| 41 | 41 | */ |
| 42 | - private $types = array(); |
|
| 42 | + private $types = array(); |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * Converts a comparison expression into the target query language output. |
@@ -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'; |
@@ -338,9 +338,9 @@ discard block |
||
| 338 | 338 | $columnName = $this->quoteStrategy->getColumnName($versionField, $versionedClass, $this->platform); |
| 339 | 339 | |
| 340 | 340 | // FIXME: Order with composite keys might not be correct |
| 341 | - $sql = 'SELECT ' . $columnName |
|
| 342 | - . ' FROM ' . $tableName |
|
| 343 | - . ' WHERE ' . implode(' = ? AND ', $identifier) . ' = ?'; |
|
| 341 | + $sql = 'SELECT '.$columnName |
|
| 342 | + . ' FROM '.$tableName |
|
| 343 | + . ' WHERE '.implode(' = ? AND ', $identifier).' = ?'; |
|
| 344 | 344 | |
| 345 | 345 | $flatId = $this->identifierFlattener->flattenIdentifier($versionedClass, $id); |
| 346 | 346 | |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | $params[] = $value; |
| 419 | - $set[] = $column . ' = ' . $placeholder; |
|
| 419 | + $set[] = $column.' = '.$placeholder; |
|
| 420 | 420 | $types[] = $this->columnTypes[$columnName]; |
| 421 | 421 | } |
| 422 | 422 | |
@@ -464,18 +464,18 @@ discard block |
||
| 464 | 464 | case Type::SMALLINT: |
| 465 | 465 | case Type::INTEGER: |
| 466 | 466 | case Type::BIGINT: |
| 467 | - $set[] = $versionColumn . ' = ' . $versionColumn . ' + 1'; |
|
| 467 | + $set[] = $versionColumn.' = '.$versionColumn.' + 1'; |
|
| 468 | 468 | break; |
| 469 | 469 | |
| 470 | 470 | case Type::DATETIME: |
| 471 | - $set[] = $versionColumn . ' = CURRENT_TIMESTAMP'; |
|
| 471 | + $set[] = $versionColumn.' = CURRENT_TIMESTAMP'; |
|
| 472 | 472 | break; |
| 473 | 473 | } |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - $sql = 'UPDATE ' . $quotedTableName |
|
| 477 | - . ' SET ' . implode(', ', $set) |
|
| 478 | - . ' WHERE ' . implode(' = ? AND ', $where) . ' = ?'; |
|
| 476 | + $sql = 'UPDATE '.$quotedTableName |
|
| 477 | + . ' SET '.implode(', ', $set) |
|
| 478 | + . ' WHERE '.implode(' = ? AND ', $where).' = ?'; |
|
| 479 | 479 | |
| 480 | 480 | $result = $this->conn->executeUpdate($sql, $params, $types); |
| 481 | 481 | |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | |
| 519 | 519 | |
| 520 | 520 | if ($selfReferential) { |
| 521 | - $otherColumns = (! $mapping['isOwningSide']) |
|
| 521 | + $otherColumns = ( ! $mapping['isOwningSide']) |
|
| 522 | 522 | ? $association['joinTable']['joinColumns'] |
| 523 | 523 | : $association['joinTable']['inverseJoinColumns']; |
| 524 | 524 | } |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | $tableName = $this->quoteStrategy->getTableName($class, $this->platform); |
| 557 | 557 | $idColumns = $this->quoteStrategy->getIdentifierColumnNames($class, $this->platform); |
| 558 | 558 | $id = array_combine($idColumns, $identifier); |
| 559 | - $types = array_map(function ($identifier) use ($class, $self) { |
|
| 559 | + $types = array_map(function($identifier) use ($class, $self) { |
|
| 560 | 560 | if (isset($class->fieldMappings[$identifier])) { |
| 561 | 561 | return $class->fieldMappings[$identifier]['type']; |
| 562 | 562 | } |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | |
| 784 | 784 | // unset the old value and set the new sql aliased value here. By definition |
| 785 | 785 | // unset($identifier[$targetKeyColumn] works here with how UnitOfWork::createEntity() calls this method. |
| 786 | - $identifier[$this->getSQLTableAlias($targetClass->name) . "." . $targetKeyColumn] = |
|
| 786 | + $identifier[$this->getSQLTableAlias($targetClass->name).".".$targetKeyColumn] = |
|
| 787 | 787 | $sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity); |
| 788 | 788 | |
| 789 | 789 | unset($identifier[$targetKeyColumn]); |
@@ -1017,7 +1017,7 @@ discard block |
||
| 1017 | 1017 | ); |
| 1018 | 1018 | } |
| 1019 | 1019 | |
| 1020 | - $criteria[$quotedJoinTable . '.' . $quotedKeyColumn] = $value; |
|
| 1020 | + $criteria[$quotedJoinTable.'.'.$quotedKeyColumn] = $value; |
|
| 1021 | 1021 | $parameters[] = array( |
| 1022 | 1022 | 'value' => $value, |
| 1023 | 1023 | 'field' => $field, |
@@ -1060,11 +1060,11 @@ discard block |
||
| 1060 | 1060 | |
| 1061 | 1061 | switch ($lockMode) { |
| 1062 | 1062 | case LockMode::PESSIMISTIC_READ: |
| 1063 | - $lockSql = ' ' . $this->platform->getReadLockSql(); |
|
| 1063 | + $lockSql = ' '.$this->platform->getReadLockSql(); |
|
| 1064 | 1064 | break; |
| 1065 | 1065 | |
| 1066 | 1066 | case LockMode::PESSIMISTIC_WRITE: |
| 1067 | - $lockSql = ' ' . $this->platform->getWriteLockSql(); |
|
| 1067 | + $lockSql = ' '.$this->platform->getWriteLockSql(); |
|
| 1068 | 1068 | break; |
| 1069 | 1069 | } |
| 1070 | 1070 | |
@@ -1075,14 +1075,14 @@ discard block |
||
| 1075 | 1075 | |
| 1076 | 1076 | if ('' !== $filterSql) { |
| 1077 | 1077 | $conditionSql = $conditionSql |
| 1078 | - ? $conditionSql . ' AND ' . $filterSql |
|
| 1078 | + ? $conditionSql.' AND '.$filterSql |
|
| 1079 | 1079 | : $filterSql; |
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | - $select = 'SELECT ' . $columnList; |
|
| 1083 | - $from = ' FROM ' . $tableName . ' '. $tableAlias; |
|
| 1084 | - $join = $this->currentPersisterContext->selectJoinSql . $joinSql; |
|
| 1085 | - $where = ($conditionSql ? ' WHERE ' . $conditionSql : ''); |
|
| 1082 | + $select = 'SELECT '.$columnList; |
|
| 1083 | + $from = ' FROM '.$tableName.' '.$tableAlias; |
|
| 1084 | + $join = $this->currentPersisterContext->selectJoinSql.$joinSql; |
|
| 1085 | + $where = ($conditionSql ? ' WHERE '.$conditionSql : ''); |
|
| 1086 | 1086 | $lock = $this->platform->appendLockHint($from, $lockMode); |
| 1087 | 1087 | $query = $select |
| 1088 | 1088 | . $lock |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | . $where |
| 1091 | 1091 | . $orderBySql; |
| 1092 | 1092 | |
| 1093 | - return $this->platform->modifyLimitQuery($query, $limit, $offset) . $lockSql; |
|
| 1093 | + return $this->platform->modifyLimitQuery($query, $limit, $offset).$lockSql; |
|
| 1094 | 1094 | } |
| 1095 | 1095 | |
| 1096 | 1096 | /** |
@@ -1109,13 +1109,13 @@ discard block |
||
| 1109 | 1109 | |
| 1110 | 1110 | if ('' !== $filterSql) { |
| 1111 | 1111 | $conditionSql = $conditionSql |
| 1112 | - ? $conditionSql . ' AND ' . $filterSql |
|
| 1112 | + ? $conditionSql.' AND '.$filterSql |
|
| 1113 | 1113 | : $filterSql; |
| 1114 | 1114 | } |
| 1115 | 1115 | |
| 1116 | 1116 | $sql = 'SELECT COUNT(*) ' |
| 1117 | - . 'FROM ' . $tableName . ' ' . $tableAlias |
|
| 1118 | - . (empty($conditionSql) ? '' : ' WHERE ' . $conditionSql); |
|
| 1117 | + . 'FROM '.$tableName.' '.$tableAlias |
|
| 1118 | + . (empty($conditionSql) ? '' : ' WHERE '.$conditionSql); |
|
| 1119 | 1119 | |
| 1120 | 1120 | return $sql; |
| 1121 | 1121 | } |
@@ -1148,7 +1148,7 @@ discard block |
||
| 1148 | 1148 | : $baseTableAlias; |
| 1149 | 1149 | |
| 1150 | 1150 | $columnName = $this->quoteStrategy->getColumnName($fieldName, $this->class, $this->platform); |
| 1151 | - $orderByList[] = $tableAlias . '.' . $columnName . ' ' . $orientation; |
|
| 1151 | + $orderByList[] = $tableAlias.'.'.$columnName.' '.$orientation; |
|
| 1152 | 1152 | |
| 1153 | 1153 | continue; |
| 1154 | 1154 | } |
@@ -1165,7 +1165,7 @@ discard block |
||
| 1165 | 1165 | |
| 1166 | 1166 | foreach ($this->class->associationMappings[$fieldName]['joinColumns'] as $joinColumn) { |
| 1167 | 1167 | $columnName = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); |
| 1168 | - $orderByList[] = $tableAlias . '.' . $columnName . ' ' . $orientation; |
|
| 1168 | + $orderByList[] = $tableAlias.'.'.$columnName.' '.$orientation; |
|
| 1169 | 1169 | } |
| 1170 | 1170 | |
| 1171 | 1171 | continue; |
@@ -1174,7 +1174,7 @@ discard block |
||
| 1174 | 1174 | throw ORMException::unrecognizedField($fieldName); |
| 1175 | 1175 | } |
| 1176 | 1176 | |
| 1177 | - return ' ORDER BY ' . implode(', ', $orderByList); |
|
| 1177 | + return ' ORDER BY '.implode(', ', $orderByList); |
|
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | 1180 | /** |
@@ -1202,8 +1202,8 @@ discard block |
||
| 1202 | 1202 | $columnList[] = $this->getSelectColumnSQL($field, $this->class); |
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | - $this->currentPersisterContext->selectJoinSql = ''; |
|
| 1206 | - $eagerAliasCounter = 0; |
|
| 1205 | + $this->currentPersisterContext->selectJoinSql = ''; |
|
| 1206 | + $eagerAliasCounter = 0; |
|
| 1207 | 1207 | |
| 1208 | 1208 | foreach ($this->class->associationMappings as $assocField => $assoc) { |
| 1209 | 1209 | $assocColumnSQL = $this->getSelectColumnAssociationSQL($assocField, $assoc, $this->class); |
@@ -1229,7 +1229,7 @@ discard block |
||
| 1229 | 1229 | continue; // now this is why you shouldn't use inheritance |
| 1230 | 1230 | } |
| 1231 | 1231 | |
| 1232 | - $assocAlias = 'e' . ($eagerAliasCounter++); |
|
| 1232 | + $assocAlias = 'e'.($eagerAliasCounter++); |
|
| 1233 | 1233 | $this->currentPersisterContext->rsm->addJoinedEntityResult($assoc['targetEntity'], $assocAlias, 'r', $assocField); |
| 1234 | 1234 | |
| 1235 | 1235 | foreach ($eagerEntity->fieldNames as $field) { |
@@ -1262,14 +1262,14 @@ discard block |
||
| 1262 | 1262 | $joinTableName = $this->quoteStrategy->getTableName($eagerEntity, $this->platform); |
| 1263 | 1263 | |
| 1264 | 1264 | if ($assoc['isOwningSide']) { |
| 1265 | - $tableAlias = $this->getSQLTableAlias($association['targetEntity'], $assocAlias); |
|
| 1266 | - $this->currentPersisterContext->selectJoinSql .= ' ' . $this->getJoinSQLForJoinColumns($association['joinColumns']); |
|
| 1265 | + $tableAlias = $this->getSQLTableAlias($association['targetEntity'], $assocAlias); |
|
| 1266 | + $this->currentPersisterContext->selectJoinSql .= ' '.$this->getJoinSQLForJoinColumns($association['joinColumns']); |
|
| 1267 | 1267 | |
| 1268 | 1268 | foreach ($association['joinColumns'] as $joinColumn) { |
| 1269 | 1269 | $sourceCol = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); |
| 1270 | 1270 | $targetCol = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $this->class, $this->platform); |
| 1271 | 1271 | $joinCondition[] = $this->getSQLTableAlias($association['sourceEntity']) |
| 1272 | - . '.' . $sourceCol . ' = ' . $tableAlias . '.' . $targetCol; |
|
| 1272 | + . '.'.$sourceCol.' = '.$tableAlias.'.'.$targetCol; |
|
| 1273 | 1273 | } |
| 1274 | 1274 | |
| 1275 | 1275 | // Add filter SQL |
@@ -1285,12 +1285,12 @@ discard block |
||
| 1285 | 1285 | $sourceCol = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); |
| 1286 | 1286 | $targetCol = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $this->class, $this->platform); |
| 1287 | 1287 | |
| 1288 | - $joinCondition[] = $this->getSQLTableAlias($association['sourceEntity'], $assocAlias) . '.' . $sourceCol . ' = ' |
|
| 1289 | - . $this->getSQLTableAlias($association['targetEntity']) . '.' . $targetCol; |
|
| 1288 | + $joinCondition[] = $this->getSQLTableAlias($association['sourceEntity'], $assocAlias).'.'.$sourceCol.' = ' |
|
| 1289 | + . $this->getSQLTableAlias($association['targetEntity']).'.'.$targetCol; |
|
| 1290 | 1290 | } |
| 1291 | 1291 | } |
| 1292 | 1292 | |
| 1293 | - $this->currentPersisterContext->selectJoinSql .= ' ' . $joinTableName . ' ' . $joinTableAlias . ' ON '; |
|
| 1293 | + $this->currentPersisterContext->selectJoinSql .= ' '.$joinTableName.' '.$joinTableAlias.' ON '; |
|
| 1294 | 1294 | $this->currentPersisterContext->selectJoinSql .= implode(' AND ', $joinCondition); |
| 1295 | 1295 | } |
| 1296 | 1296 | |
@@ -1311,7 +1311,7 @@ discard block |
||
| 1311 | 1311 | */ |
| 1312 | 1312 | protected function getSelectColumnAssociationSQL($field, $assoc, ClassMetadata $class, $alias = 'r') |
| 1313 | 1313 | { |
| 1314 | - if ( ! ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE) ) { |
|
| 1314 | + if ( ! ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE)) { |
|
| 1315 | 1315 | return ''; |
| 1316 | 1316 | } |
| 1317 | 1317 | |
@@ -1360,10 +1360,10 @@ discard block |
||
| 1360 | 1360 | foreach ($joinColumns as $joinColumn) { |
| 1361 | 1361 | $quotedSourceColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); |
| 1362 | 1362 | $quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $this->class, $this->platform); |
| 1363 | - $conditions[] = $sourceTableAlias . '.' . $quotedTargetColumn . ' = ' . $joinTableName . '.' . $quotedSourceColumn; |
|
| 1363 | + $conditions[] = $sourceTableAlias.'.'.$quotedTargetColumn.' = '.$joinTableName.'.'.$quotedSourceColumn; |
|
| 1364 | 1364 | } |
| 1365 | 1365 | |
| 1366 | - return ' INNER JOIN ' . $joinTableName . ' ON ' . implode(' AND ', $conditions); |
|
| 1366 | + return ' INNER JOIN '.$joinTableName.' ON '.implode(' AND ', $conditions); |
|
| 1367 | 1367 | } |
| 1368 | 1368 | |
| 1369 | 1369 | /** |
@@ -1463,7 +1463,7 @@ discard block |
||
| 1463 | 1463 | */ |
| 1464 | 1464 | protected function getSelectColumnSQL($field, ClassMetadata $class, $alias = 'r') |
| 1465 | 1465 | { |
| 1466 | - $root = $alias == 'r' ? '' : $alias ; |
|
| 1466 | + $root = $alias == 'r' ? '' : $alias; |
|
| 1467 | 1467 | $tableAlias = $this->getSQLTableAlias($class->name, $root); |
| 1468 | 1468 | $fieldMapping = $class->fieldMappings[$field]; |
| 1469 | 1469 | $sql = sprintf('%s.%s', $tableAlias, $this->quoteStrategy->getColumnName($field, $class, $this->platform)); |
@@ -1476,7 +1476,7 @@ discard block |
||
| 1476 | 1476 | $sql = $type->convertToPHPValueSQL($sql, $this->platform); |
| 1477 | 1477 | } |
| 1478 | 1478 | |
| 1479 | - return $sql . ' AS ' . $columnAlias; |
|
| 1479 | + return $sql.' AS '.$columnAlias; |
|
| 1480 | 1480 | } |
| 1481 | 1481 | |
| 1482 | 1482 | /** |
@@ -1492,14 +1492,14 @@ discard block |
||
| 1492 | 1492 | protected function getSQLTableAlias($className, $assocName = '') |
| 1493 | 1493 | { |
| 1494 | 1494 | if ($assocName) { |
| 1495 | - $className .= '#' . $assocName; |
|
| 1495 | + $className .= '#'.$assocName; |
|
| 1496 | 1496 | } |
| 1497 | 1497 | |
| 1498 | 1498 | if (isset($this->currentPersisterContext->sqlTableAliases[$className])) { |
| 1499 | 1499 | return $this->currentPersisterContext->sqlTableAliases[$className]; |
| 1500 | 1500 | } |
| 1501 | 1501 | |
| 1502 | - $tableAlias = 't' . $this->currentPersisterContext->sqlAliasCounter++; |
|
| 1502 | + $tableAlias = 't'.$this->currentPersisterContext->sqlAliasCounter++; |
|
| 1503 | 1503 | |
| 1504 | 1504 | $this->currentPersisterContext->sqlTableAliases[$className] = $tableAlias; |
| 1505 | 1505 | |
@@ -1526,7 +1526,7 @@ discard block |
||
| 1526 | 1526 | } |
| 1527 | 1527 | |
| 1528 | 1528 | $lock = $this->getLockTablesSql($lockMode); |
| 1529 | - $where = ($conditionSql ? ' WHERE ' . $conditionSql : '') . ' '; |
|
| 1529 | + $where = ($conditionSql ? ' WHERE '.$conditionSql : '').' '; |
|
| 1530 | 1530 | $sql = 'SELECT 1 ' |
| 1531 | 1531 | . $lock |
| 1532 | 1532 | . $where |
@@ -1548,7 +1548,7 @@ discard block |
||
| 1548 | 1548 | { |
| 1549 | 1549 | return $this->platform->appendLockHint( |
| 1550 | 1550 | 'FROM ' |
| 1551 | - . $this->quoteStrategy->getTableName($this->class, $this->platform) . ' ' |
|
| 1551 | + . $this->quoteStrategy->getTableName($this->class, $this->platform).' ' |
|
| 1552 | 1552 | . $this->getSQLTableAlias($this->class->name), |
| 1553 | 1553 | $lockMode |
| 1554 | 1554 | ); |
@@ -1600,19 +1600,19 @@ discard block |
||
| 1600 | 1600 | |
| 1601 | 1601 | if (null !== $comparison) { |
| 1602 | 1602 | // special case null value handling |
| 1603 | - if (($comparison === Comparison::EQ || $comparison === Comparison::IS) && null ===$value) { |
|
| 1604 | - $selectedColumns[] = $column . ' IS NULL'; |
|
| 1603 | + if (($comparison === Comparison::EQ || $comparison === Comparison::IS) && null === $value) { |
|
| 1604 | + $selectedColumns[] = $column.' IS NULL'; |
|
| 1605 | 1605 | |
| 1606 | 1606 | continue; |
| 1607 | 1607 | } |
| 1608 | 1608 | |
| 1609 | 1609 | if ($comparison === Comparison::NEQ && null === $value) { |
| 1610 | - $selectedColumns[] = $column . ' IS NOT NULL'; |
|
| 1610 | + $selectedColumns[] = $column.' IS NOT NULL'; |
|
| 1611 | 1611 | |
| 1612 | 1612 | continue; |
| 1613 | 1613 | } |
| 1614 | 1614 | |
| 1615 | - $selectedColumns[] = $column . ' ' . sprintf(self::$comparisonMap[$comparison], $placeholder); |
|
| 1615 | + $selectedColumns[] = $column.' '.sprintf(self::$comparisonMap[$comparison], $placeholder); |
|
| 1616 | 1616 | |
| 1617 | 1617 | continue; |
| 1618 | 1618 | } |
@@ -1660,7 +1660,7 @@ discard block |
||
| 1660 | 1660 | ? $this->class->fieldMappings[$field]['inherited'] |
| 1661 | 1661 | : $this->class->name; |
| 1662 | 1662 | |
| 1663 | - return array($this->getSQLTableAlias($className) . '.' . $this->quoteStrategy->getColumnName($field, $this->class, $this->platform)); |
|
| 1663 | + return array($this->getSQLTableAlias($className).'.'.$this->quoteStrategy->getColumnName($field, $this->class, $this->platform)); |
|
| 1664 | 1664 | } |
| 1665 | 1665 | |
| 1666 | 1666 | if (isset($this->class->associationMappings[$field])) { |
@@ -1681,7 +1681,7 @@ discard block |
||
| 1681 | 1681 | |
| 1682 | 1682 | |
| 1683 | 1683 | foreach ($joinColumns as $joinColumn) { |
| 1684 | - $columns[] = $joinTableName . '.' . $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform); |
|
| 1684 | + $columns[] = $joinTableName.'.'.$this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform); |
|
| 1685 | 1685 | } |
| 1686 | 1686 | |
| 1687 | 1687 | } else { |
@@ -1689,12 +1689,12 @@ discard block |
||
| 1689 | 1689 | throw ORMException::invalidFindByInverseAssociation($this->class->name, $field); |
| 1690 | 1690 | } |
| 1691 | 1691 | |
| 1692 | - $className = (isset($association['inherited'])) |
|
| 1692 | + $className = (isset($association['inherited'])) |
|
| 1693 | 1693 | ? $association['inherited'] |
| 1694 | 1694 | : $this->class->name; |
| 1695 | 1695 | |
| 1696 | 1696 | foreach ($association['joinColumns'] as $joinColumn) { |
| 1697 | - $columns[] = $this->getSQLTableAlias($className) . '.' . $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); |
|
| 1697 | + $columns[] = $this->getSQLTableAlias($className).'.'.$this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); |
|
| 1698 | 1698 | } |
| 1699 | 1699 | } |
| 1700 | 1700 | return $columns; |
@@ -1786,7 +1786,7 @@ discard block |
||
| 1786 | 1786 | $value = $value[$this->em->getClassMetadata($sourceClass->associationMappings[$field]['targetEntity'])->identifier[0]]; |
| 1787 | 1787 | } |
| 1788 | 1788 | |
| 1789 | - $criteria[$tableAlias . "." . $targetKeyColumn] = $value; |
|
| 1789 | + $criteria[$tableAlias.".".$targetKeyColumn] = $value; |
|
| 1790 | 1790 | $parameters[] = array( |
| 1791 | 1791 | 'value' => $value, |
| 1792 | 1792 | 'field' => $field, |
@@ -1799,7 +1799,7 @@ discard block |
||
| 1799 | 1799 | $field = $sourceClass->fieldNames[$sourceKeyColumn]; |
| 1800 | 1800 | $value = $sourceClass->reflFields[$field]->getValue($sourceEntity); |
| 1801 | 1801 | |
| 1802 | - $criteria[$tableAlias . "." . $targetKeyColumn] = $value; |
|
| 1802 | + $criteria[$tableAlias.".".$targetKeyColumn] = $value; |
|
| 1803 | 1803 | $parameters[] = array( |
| 1804 | 1804 | 'value' => $value, |
| 1805 | 1805 | 'field' => $field, |
@@ -1886,7 +1886,7 @@ discard block |
||
| 1886 | 1886 | $assoc = $class->associationMappings[$field]; |
| 1887 | 1887 | $class = $this->em->getClassMetadata($assoc['targetEntity']); |
| 1888 | 1888 | |
| 1889 | - if (! $assoc['isOwningSide']) { |
|
| 1889 | + if ( ! $assoc['isOwningSide']) { |
|
| 1890 | 1890 | $assoc = $class->associationMappings[$assoc['mappedBy']]; |
| 1891 | 1891 | $class = $this->em->getClassMetadata($assoc['targetEntity']); |
| 1892 | 1892 | } |
@@ -1895,7 +1895,7 @@ discard block |
||
| 1895 | 1895 | ? $assoc['relationToTargetKeyColumns'] |
| 1896 | 1896 | : $assoc['sourceToTargetKeyColumns']; |
| 1897 | 1897 | |
| 1898 | - foreach ($columns as $column){ |
|
| 1898 | + foreach ($columns as $column) { |
|
| 1899 | 1899 | $types[] = PersisterHelper::getTypeOfColumn($column, $class, $this->em); |
| 1900 | 1900 | } |
| 1901 | 1901 | break; |
@@ -1906,7 +1906,7 @@ discard block |
||
| 1906 | 1906 | } |
| 1907 | 1907 | |
| 1908 | 1908 | if (is_array($value)) { |
| 1909 | - return array_map(function ($type) { |
|
| 1909 | + return array_map(function($type) { |
|
| 1910 | 1910 | $type = Type::getType($type); |
| 1911 | 1911 | |
| 1912 | 1912 | return $type->getBindingType() + Connection::ARRAY_PARAM_OFFSET; |
@@ -1982,12 +1982,12 @@ discard block |
||
| 1982 | 1982 | |
| 1983 | 1983 | $sql = 'SELECT 1 ' |
| 1984 | 1984 | . $this->getLockTablesSql(null) |
| 1985 | - . ' WHERE ' . $this->getSelectConditionSQL($criteria); |
|
| 1985 | + . ' WHERE '.$this->getSelectConditionSQL($criteria); |
|
| 1986 | 1986 | |
| 1987 | 1987 | list($params, $types) = $this->expandParameters($criteria); |
| 1988 | 1988 | |
| 1989 | 1989 | if (null !== $extraConditions) { |
| 1990 | - $sql .= ' AND ' . $this->getSelectConditionCriteriaSQL($extraConditions); |
|
| 1990 | + $sql .= ' AND '.$this->getSelectConditionCriteriaSQL($extraConditions); |
|
| 1991 | 1991 | list($criteriaParams, $criteriaTypes) = $this->expandCriteriaParameters($extraConditions); |
| 1992 | 1992 | |
| 1993 | 1993 | $params = array_merge($params, $criteriaParams); |
@@ -1995,7 +1995,7 @@ discard block |
||
| 1995 | 1995 | } |
| 1996 | 1996 | |
| 1997 | 1997 | if ($filterSql = $this->generateFilterConditionSQL($this->class, $alias)) { |
| 1998 | - $sql .= ' AND ' . $filterSql; |
|
| 1998 | + $sql .= ' AND '.$filterSql; |
|
| 1999 | 1999 | } |
| 2000 | 2000 | |
| 2001 | 2001 | return (bool) $this->conn->fetchColumn($sql, $params, 0, $types); |
@@ -2042,13 +2042,13 @@ discard block |
||
| 2042 | 2042 | |
| 2043 | 2043 | foreach ($this->em->getFilters()->getEnabledFilters() as $filter) { |
| 2044 | 2044 | if ('' !== $filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias)) { |
| 2045 | - $filterClauses[] = '(' . $filterExpr . ')'; |
|
| 2045 | + $filterClauses[] = '('.$filterExpr.')'; |
|
| 2046 | 2046 | } |
| 2047 | 2047 | } |
| 2048 | 2048 | |
| 2049 | 2049 | $sql = implode(' AND ', $filterClauses); |
| 2050 | 2050 | |
| 2051 | - return $sql ? "(" . $sql . ")" : ""; // Wrap again to avoid "X or Y and FilterConditionSQL" |
|
| 2051 | + return $sql ? "(".$sql.")" : ""; // Wrap again to avoid "X or Y and FilterConditionSQL" |
|
| 2052 | 2052 | } |
| 2053 | 2053 | |
| 2054 | 2054 | /** |
@@ -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 | /** |