@@ -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 | )); |
@@ -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 | } |
@@ -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 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $sql = $type->convertToPHPValueSQL($sql, $this->platform); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - return $sql . ' AS ' . $columnAlias; |
|
| 79 | + return $sql.' AS '.$columnAlias; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -93,6 +93,6 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | $this->currentPersisterContext->rsm->addMetaResult('r', $columnAlias, $joinColumnName, false, $type); |
| 95 | 95 | |
| 96 | - return $tableAlias . '.' . $joinColumnName . ' AS ' . $columnAlias; |
|
| 96 | + return $tableAlias.'.'.$joinColumnName.' AS '.$columnAlias; |
|
| 97 | 97 | } |
| 98 | 98 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | foreach ($data as $columnName => $value) { |
| 211 | - if (!is_array($id) || !isset($id[$columnName])) { |
|
| 211 | + if ( ! is_array($id) || ! isset($id[$columnName])) { |
|
| 212 | 212 | $stmt->bindValue($paramIndex++, $value, $this->columnTypes[$columnName]); |
| 213 | 213 | } |
| 214 | 214 | } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | // If the current class in the root entity, add the filters |
| 324 | 324 | if ($filterSql = $this->generateFilterConditionSQL($this->em->getClassMetadata($this->class->rootEntityName), $this->getSQLTableAlias($this->class->rootEntityName))) { |
| 325 | 325 | $conditionSql .= $conditionSql |
| 326 | - ? ' AND ' . $filterSql |
|
| 326 | + ? ' AND '.$filterSql |
|
| 327 | 327 | : $filterSql; |
| 328 | 328 | } |
| 329 | 329 | |
@@ -342,29 +342,29 @@ discard block |
||
| 342 | 342 | switch ($lockMode) { |
| 343 | 343 | case LockMode::PESSIMISTIC_READ: |
| 344 | 344 | |
| 345 | - $lockSql = ' ' . $this->platform->getReadLockSql(); |
|
| 345 | + $lockSql = ' '.$this->platform->getReadLockSql(); |
|
| 346 | 346 | |
| 347 | 347 | break; |
| 348 | 348 | |
| 349 | 349 | case LockMode::PESSIMISTIC_WRITE: |
| 350 | 350 | |
| 351 | - $lockSql = ' ' . $this->platform->getWriteLockSql(); |
|
| 351 | + $lockSql = ' '.$this->platform->getWriteLockSql(); |
|
| 352 | 352 | |
| 353 | 353 | break; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | $tableName = $this->quoteStrategy->getTableName($this->class, $this->platform); |
| 357 | - $from = ' FROM ' . $tableName . ' ' . $baseTableAlias; |
|
| 358 | - $where = $conditionSql != '' ? ' WHERE ' . $conditionSql : ''; |
|
| 357 | + $from = ' FROM '.$tableName.' '.$baseTableAlias; |
|
| 358 | + $where = $conditionSql != '' ? ' WHERE '.$conditionSql : ''; |
|
| 359 | 359 | $lock = $this->platform->appendLockHint($from, $lockMode); |
| 360 | 360 | $columnList = $this->getSelectColumnsSQL(); |
| 361 | - $query = 'SELECT ' . $columnList |
|
| 361 | + $query = 'SELECT '.$columnList |
|
| 362 | 362 | . $lock |
| 363 | 363 | . $joinSql |
| 364 | 364 | . $where |
| 365 | 365 | . $orderBySql; |
| 366 | 366 | |
| 367 | - return $this->platform->modifyLimitQuery($query, $limit, $offset) . $lockSql; |
|
| 367 | + return $this->platform->modifyLimitQuery($query, $limit, $offset).$lockSql; |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | /** |
@@ -384,14 +384,14 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | if ('' !== $filterSql) { |
| 386 | 386 | $conditionSql = $conditionSql |
| 387 | - ? $conditionSql . ' AND ' . $filterSql |
|
| 387 | + ? $conditionSql.' AND '.$filterSql |
|
| 388 | 388 | : $filterSql; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | $sql = 'SELECT COUNT(*) ' |
| 392 | - . 'FROM ' . $tableName . ' ' . $baseTableAlias |
|
| 392 | + . 'FROM '.$tableName.' '.$baseTableAlias |
|
| 393 | 393 | . $joinSql |
| 394 | - . (empty($conditionSql) ? '' : ' WHERE ' . $conditionSql); |
|
| 394 | + . (empty($conditionSql) ? '' : ' WHERE '.$conditionSql); |
|
| 395 | 395 | |
| 396 | 396 | return $sql; |
| 397 | 397 | } |
@@ -410,16 +410,16 @@ discard block |
||
| 410 | 410 | $conditions = array(); |
| 411 | 411 | $tableAlias = $this->getSQLTableAlias($parentClassName); |
| 412 | 412 | $parentClass = $this->em->getClassMetadata($parentClassName); |
| 413 | - $joinSql .= ' INNER JOIN ' . $this->quoteStrategy->getTableName($parentClass, $this->platform) . ' ' . $tableAlias . ' ON '; |
|
| 413 | + $joinSql .= ' INNER JOIN '.$this->quoteStrategy->getTableName($parentClass, $this->platform).' '.$tableAlias.' ON '; |
|
| 414 | 414 | |
| 415 | 415 | foreach ($identifierColumns as $idColumn) { |
| 416 | - $conditions[] = $baseTableAlias . '.' . $idColumn . ' = ' . $tableAlias . '.' . $idColumn; |
|
| 416 | + $conditions[] = $baseTableAlias.'.'.$idColumn.' = '.$tableAlias.'.'.$idColumn; |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | $joinSql .= implode(' AND ', $conditions); |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - return parent::getLockTablesSql($lockMode) . $joinSql; |
|
| 422 | + return parent::getLockTablesSql($lockMode).$joinSql; |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | /** |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | ? $baseTableAlias |
| 489 | 489 | : $this->getSQLTableAlias($this->class->rootEntityName); |
| 490 | 490 | |
| 491 | - $columnList[] = $tableAlias . '.' . $discrColumn; |
|
| 491 | + $columnList[] = $tableAlias.'.'.$discrColumn; |
|
| 492 | 492 | |
| 493 | 493 | // sub tables |
| 494 | 494 | foreach ($this->class->subClasses as $subClassName) { |
@@ -603,11 +603,11 @@ discard block |
||
| 603 | 603 | $conditions = array(); |
| 604 | 604 | $parentClass = $this->em->getClassMetadata($parentClassName); |
| 605 | 605 | $tableAlias = $this->getSQLTableAlias($parentClassName); |
| 606 | - $joinSql .= ' INNER JOIN ' . $this->quoteStrategy->getTableName($parentClass, $this->platform) . ' ' . $tableAlias . ' ON '; |
|
| 606 | + $joinSql .= ' INNER JOIN '.$this->quoteStrategy->getTableName($parentClass, $this->platform).' '.$tableAlias.' ON '; |
|
| 607 | 607 | |
| 608 | 608 | |
| 609 | 609 | foreach ($identifierColumn as $idColumn) { |
| 610 | - $conditions[] = $baseTableAlias . '.' . $idColumn . ' = ' . $tableAlias . '.' . $idColumn; |
|
| 610 | + $conditions[] = $baseTableAlias.'.'.$idColumn.' = '.$tableAlias.'.'.$idColumn; |
|
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | $joinSql .= implode(' AND ', $conditions); |
@@ -618,10 +618,10 @@ discard block |
||
| 618 | 618 | $conditions = array(); |
| 619 | 619 | $subClass = $this->em->getClassMetadata($subClassName); |
| 620 | 620 | $tableAlias = $this->getSQLTableAlias($subClassName); |
| 621 | - $joinSql .= ' LEFT JOIN ' . $this->quoteStrategy->getTableName($subClass, $this->platform) . ' ' . $tableAlias . ' ON '; |
|
| 621 | + $joinSql .= ' LEFT JOIN '.$this->quoteStrategy->getTableName($subClass, $this->platform).' '.$tableAlias.' ON '; |
|
| 622 | 622 | |
| 623 | 623 | foreach ($identifierColumn as $idColumn) { |
| 624 | - $conditions[] = $baseTableAlias . '.' . $idColumn . ' = ' . $tableAlias . '.' . $idColumn; |
|
| 624 | + $conditions[] = $baseTableAlias.'.'.$idColumn.' = '.$tableAlias.'.'.$idColumn; |
|
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | $joinSql .= implode(' AND ', $conditions); |
@@ -151,7 +151,7 @@ |
||
| 151 | 151 | */ |
| 152 | 152 | public function newDefaultAnnotationDriver($paths = array(), $useSimpleAnnotationReader = true) |
| 153 | 153 | { |
| 154 | - AnnotationRegistry::registerFile(__DIR__ . '/Mapping/Driver/DoctrineAnnotations.php'); |
|
| 154 | + AnnotationRegistry::registerFile(__DIR__.'/Mapping/Driver/DoctrineAnnotations.php'); |
|
| 155 | 155 | |
| 156 | 156 | if ($useSimpleAnnotationReader) { |
| 157 | 157 | // Register the ORM Annotations in the AnnotationRegistry |