@@ -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; |
@@ -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 | )); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | foreach ($joinColumns as $joinColumn) { |
133 | 133 | $columnName = $this->quoteStrategy->getJoinColumnName($joinColumn, $sourceClass, $this->platform); |
134 | 134 | $referencedName = $joinColumn['referencedColumnName']; |
135 | - $conditions[] = 't.' . $columnName . ' = ?'; |
|
135 | + $conditions[] = 't.'.$columnName.' = ?'; |
|
136 | 136 | $params[] = $id[$sourceClass->getFieldForColumn($referencedName)]; |
137 | 137 | $types[] = PersisterHelper::getTypeOfColumn($referencedName, $sourceClass, $this->em); |
138 | 138 | } |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | }*/ |
162 | 162 | |
163 | 163 | $sql = 'SELECT COUNT(*)' |
164 | - . ' FROM ' . $joinTableName . ' t' |
|
164 | + . ' FROM '.$joinTableName.' t' |
|
165 | 165 | . $joinTargetEntitySQL |
166 | - . ' WHERE ' . implode(' AND ', $conditions); |
|
166 | + . ' WHERE '.implode(' AND ', $conditions); |
|
167 | 167 | |
168 | 168 | return $this->conn->fetchColumn($sql, $params, 0, $types); |
169 | 169 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | list($quotedJoinTable, $whereClauses, $params, $types) = $this->getJoinTableRestrictionsWithKey($collection, $key, true); |
193 | 193 | |
194 | - $sql = 'SELECT 1 FROM ' . $quotedJoinTable . ' WHERE ' . implode(' AND ', $whereClauses); |
|
194 | + $sql = 'SELECT 1 FROM '.$quotedJoinTable.' WHERE '.implode(' AND ', $whereClauses); |
|
195 | 195 | |
196 | 196 | return (bool) $this->conn->fetchColumn($sql, $params, 0, $types); |
197 | 197 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | list($quotedJoinTable, $whereClauses, $params, $types) = $this->getJoinTableRestrictions($collection, $element, true); |
209 | 209 | |
210 | - $sql = 'SELECT 1 FROM ' . $quotedJoinTable . ' WHERE ' . implode(' AND ', $whereClauses); |
|
210 | + $sql = 'SELECT 1 FROM '.$quotedJoinTable.' WHERE '.implode(' AND ', $whereClauses); |
|
211 | 211 | |
212 | 212 | return (bool) $this->conn->fetchColumn($sql, $params, 0, $types); |
213 | 213 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | list($quotedJoinTable, $whereClauses, $params, $types) = $this->getJoinTableRestrictions($collection, $element, false); |
225 | 225 | |
226 | - $sql = 'DELETE FROM ' . $quotedJoinTable . ' WHERE ' . implode(' AND ', $whereClauses); |
|
226 | + $sql = 'DELETE FROM '.$quotedJoinTable.' WHERE '.implode(' AND ', $whereClauses); |
|
227 | 227 | |
228 | 228 | return (bool) $this->conn->executeUpdate($sql, $params, $types); |
229 | 229 | } |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | $rsm = new Query\ResultSetMappingBuilder($this->em); |
261 | 261 | $rsm->addRootEntityFromClassMetadata($mapping['targetEntity'], 'te'); |
262 | 262 | |
263 | - $sql = 'SELECT ' . $rsm->generateSelectClause() |
|
264 | - . ' FROM ' . $tableName . ' te' |
|
265 | - . ' JOIN ' . $joinTable . ' t ON' |
|
263 | + $sql = 'SELECT '.$rsm->generateSelectClause() |
|
264 | + . ' FROM '.$tableName.' te' |
|
265 | + . ' JOIN '.$joinTable.' t ON' |
|
266 | 266 | . implode(' AND ', $onConditions) |
267 | - . ' WHERE ' . implode(' AND ', $whereClauses); |
|
267 | + . ' WHERE '.implode(' AND ', $whereClauses); |
|
268 | 268 | |
269 | 269 | $stmt = $this->conn->executeQuery($sql, $params); |
270 | 270 | |
@@ -301,8 +301,8 @@ discard block |
||
301 | 301 | |
302 | 302 | // A join is needed if there is filtering on the target entity |
303 | 303 | $tableName = $this->quoteStrategy->getTableName($rootClass, $this->platform); |
304 | - $joinSql = ' JOIN ' . $tableName . ' te' |
|
305 | - . ' ON' . implode(' AND ', $this->getOnConditionSQL($mapping)); |
|
304 | + $joinSql = ' JOIN '.$tableName.' te' |
|
305 | + . ' ON'.implode(' AND ', $this->getOnConditionSQL($mapping)); |
|
306 | 306 | |
307 | 307 | return array($joinSql, $filterSql); |
308 | 308 | } |
@@ -321,12 +321,12 @@ discard block |
||
321 | 321 | |
322 | 322 | foreach ($this->em->getFilters()->getEnabledFilters() as $filter) { |
323 | 323 | if ($filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias)) { |
324 | - $filterClauses[] = '(' . $filterExpr . ')'; |
|
324 | + $filterClauses[] = '('.$filterExpr.')'; |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | |
328 | 328 | return $filterClauses |
329 | - ? '(' . implode(' AND ', $filterClauses) . ')' |
|
329 | + ? '('.implode(' AND ', $filterClauses).')' |
|
330 | 330 | : ''; |
331 | 331 | } |
332 | 332 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $joinColumnName = $this->quoteStrategy->getJoinColumnName($joinColumn, $targetClass, $this->platform); |
355 | 355 | $refColumnName = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $targetClass, $this->platform); |
356 | 356 | |
357 | - $conditions[] = ' t.' . $joinColumnName . ' = ' . 'te.' . $refColumnName; |
|
357 | + $conditions[] = ' t.'.$joinColumnName.' = '.'te.'.$refColumnName; |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | return $conditions; |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | $columns[] = $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform); |
377 | 377 | } |
378 | 378 | |
379 | - return 'DELETE FROM ' . $joinTable |
|
380 | - . ' WHERE ' . implode(' = ? AND ', $columns) . ' = ?'; |
|
379 | + return 'DELETE FROM '.$joinTable |
|
380 | + . ' WHERE '.implode(' = ? AND ', $columns).' = ?'; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | /** |
@@ -436,8 +436,8 @@ discard block |
||
436 | 436 | } |
437 | 437 | |
438 | 438 | return array( |
439 | - 'DELETE FROM ' . $this->quoteStrategy->getJoinTableName($mapping, $class, $this->platform) |
|
440 | - . ' WHERE ' . implode(' = ? AND ', $columns) . ' = ?', |
|
439 | + 'DELETE FROM '.$this->quoteStrategy->getJoinTableName($mapping, $class, $this->platform) |
|
440 | + . ' WHERE '.implode(' = ? AND ', $columns).' = ?', |
|
441 | 441 | $types, |
442 | 442 | ); |
443 | 443 | } |
@@ -485,10 +485,10 @@ discard block |
||
485 | 485 | } |
486 | 486 | |
487 | 487 | return array( |
488 | - 'INSERT INTO ' . $this->quoteStrategy->getJoinTableName($mapping, $class, $this->platform) |
|
489 | - . ' (' . implode(', ', $columns) . ')' |
|
488 | + 'INSERT INTO '.$this->quoteStrategy->getJoinTableName($mapping, $class, $this->platform) |
|
489 | + . ' ('.implode(', ', $columns).')' |
|
490 | 490 | . ' VALUES' |
491 | - . ' (' . implode(', ', array_fill(0, count($columns), '?')) . ')', |
|
491 | + . ' ('.implode(', ', array_fill(0, count($columns), '?')).')', |
|
492 | 492 | $types, |
493 | 493 | ); |
494 | 494 | } |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | $sourceClass = $this->em->getClassMetadata($mapping['sourceEntity']); |
574 | 574 | $targetClass = $this->em->getClassMetadata($mapping['targetEntity']); |
575 | 575 | |
576 | - if (! $mapping['isOwningSide']) { |
|
576 | + if ( ! $mapping['isOwningSide']) { |
|
577 | 577 | $associationSourceClass = $this->em->getClassMetadata($mapping['targetEntity']); |
578 | 578 | $mapping = $associationSourceClass->associationMappings[$mapping['mappedBy']]; |
579 | 579 | $joinColumns = $mapping['joinTable']['joinColumns']; |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | $targetRelationMode = 'relationToTargetKeyColumns'; |
587 | 587 | } |
588 | 588 | |
589 | - $quotedJoinTable = $this->quoteStrategy->getJoinTableName($mapping, $associationSourceClass, $this->platform). ' t'; |
|
589 | + $quotedJoinTable = $this->quoteStrategy->getJoinTableName($mapping, $associationSourceClass, $this->platform).' t'; |
|
590 | 590 | $whereClauses = array(); |
591 | 591 | $params = array(); |
592 | 592 | $types = array(); |
@@ -597,14 +597,14 @@ discard block |
||
597 | 597 | $joinConditions = array(); |
598 | 598 | |
599 | 599 | foreach ($joinColumns as $joinTableColumn) { |
600 | - $joinConditions[] = 't.' . $joinTableColumn['name'] . ' = tr.' . $joinTableColumn['referencedColumnName']; |
|
600 | + $joinConditions[] = 't.'.$joinTableColumn['name'].' = tr.'.$joinTableColumn['referencedColumnName']; |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | $tableName = $this->quoteStrategy->getTableName($targetClass, $this->platform); |
604 | - $quotedJoinTable .= ' JOIN ' . $tableName . ' tr ON ' . implode(' AND ', $joinConditions); |
|
604 | + $quotedJoinTable .= ' JOIN '.$tableName.' tr ON '.implode(' AND ', $joinConditions); |
|
605 | 605 | $columnName = $targetClass->getColumnName($indexBy); |
606 | 606 | |
607 | - $whereClauses[] = 'tr.' . $columnName . ' = ?'; |
|
607 | + $whereClauses[] = 'tr.'.$columnName.' = ?'; |
|
608 | 608 | $params[] = $key; |
609 | 609 | $types[] = PersisterHelper::getTypeOfColumn($columnName, $targetClass, $this->em); |
610 | 610 | } |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | foreach ($mapping['joinTableColumns'] as $joinTableColumn) { |
613 | 613 | if (isset($mapping[$sourceRelationMode][$joinTableColumn])) { |
614 | 614 | $column = $mapping[$sourceRelationMode][$joinTableColumn]; |
615 | - $whereClauses[] = 't.' . $joinTableColumn . ' = ?'; |
|
615 | + $whereClauses[] = 't.'.$joinTableColumn.' = ?'; |
|
616 | 616 | $params[] = $sourceClass->containsForeignIdentifier |
617 | 617 | ? $id[$sourceClass->getFieldForColumn($column)] |
618 | 618 | : $id[$sourceClass->fieldNames[$column]]; |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | } elseif ( ! $joinNeeded) { |
621 | 621 | $column = $mapping[$targetRelationMode][$joinTableColumn]; |
622 | 622 | |
623 | - $whereClauses[] = 't.' . $joinTableColumn . ' = ?'; |
|
623 | + $whereClauses[] = 't.'.$joinTableColumn.' = ?'; |
|
624 | 624 | $params[] = $key; |
625 | 625 | $types[] = PersisterHelper::getTypeOfColumn($column, $targetClass, $this->em); |
626 | 626 | } |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | list($joinTargetEntitySQL, $filterSql) = $this->getFilterSql($filterMapping); |
631 | 631 | |
632 | 632 | if ($filterSql) { |
633 | - $quotedJoinTable .= ' ' . $joinTargetEntitySQL; |
|
633 | + $quotedJoinTable .= ' '.$joinTargetEntitySQL; |
|
634 | 634 | $whereClauses[] = $filterSql; |
635 | 635 | } |
636 | 636 | } |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | $types = array(); |
675 | 675 | |
676 | 676 | foreach ($mapping['joinTableColumns'] as $joinTableColumn) { |
677 | - $whereClauses[] = ($addFilters ? 't.' : '') . $joinTableColumn . ' = ?'; |
|
677 | + $whereClauses[] = ($addFilters ? 't.' : '').$joinTableColumn.' = ?'; |
|
678 | 678 | |
679 | 679 | if (isset($mapping['relationToTargetKeyColumns'][$joinTableColumn])) { |
680 | 680 | $targetColumn = $mapping['relationToTargetKeyColumns'][$joinTableColumn]; |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | list($joinTargetEntitySQL, $filterSql) = $this->getFilterSql($filterMapping); |
697 | 697 | |
698 | 698 | if ($filterSql) { |
699 | - $quotedJoinTable .= ' ' . $joinTargetEntitySQL; |
|
699 | + $quotedJoinTable .= ' '.$joinTargetEntitySQL; |
|
700 | 700 | $whereClauses[] = $filterSql; |
701 | 701 | } |
702 | 702 | } |
@@ -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 | } |
@@ -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. |