@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | $statement = 'INSERT INTO ' . $table . ' (' . implode(',', $cols) . ') ' . |
| 688 | - 'VALUES (' . implode('),(', $associations) . ')'; |
|
| 688 | + 'VALUES (' . implode('),(', $associations) . ')'; |
|
| 689 | 689 | $this->entityManager->getConnection()->query($statement); |
| 690 | 690 | } |
| 691 | 691 | |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | $where[] = $this->entityManager->escapeIdentifier($fkCol) . ' = ' . |
| 729 | - $this->entityManager->escapeValue($value); |
|
| 729 | + $this->entityManager->escapeValue($value); |
|
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | foreach ($entities as $entity) { |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | $statement = 'DELETE FROM ' . $table . ' WHERE ' . array_shift($where) . ' ' . |
| 752 | - 'AND (' . implode(' OR ', $where) . ')'; |
|
| 752 | + 'AND (' . implode(' OR ', $where) . ')'; |
|
| 753 | 753 | $this->entityManager->getConnection()->query($statement); |
| 754 | 754 | } |
| 755 | 755 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | static::$namingUsed = true; |
| 126 | 126 | $reflection = self::getReflection(); |
| 127 | 127 | |
| 128 | - $tableName = preg_replace_callback('/%([a-z]+)(\[(-?\d+)(\*)?\])?%/', function ($match) use ($reflection) { |
|
| 128 | + $tableName = preg_replace_callback('/%([a-z]+)(\[(-?\d+)(\*)?\])?%/', function($match) use ($reflection) { |
|
| 129 | 129 | switch ($match[1]) { |
| 130 | 130 | case 'short': |
| 131 | 131 | $words = [$reflection->getShortName()]; |
@@ -151,8 +151,7 @@ discard block |
||
| 151 | 151 | $from = $match[3][0] === '-' ? count($words) - substr($match[3], 1) : $match[3]; |
| 152 | 152 | if (isset($words[$from])) { |
| 153 | 153 | return !isset($match[4]) ? |
| 154 | - $words[$from] : |
|
| 155 | - implode('_', array_slice($words, $from)); |
|
| 154 | + $words[$from] : implode('_', array_slice($words, $from)); |
|
| 156 | 155 | } |
| 157 | 156 | return ''; |
| 158 | 157 | }, static::getTableNameTemplate()); |
@@ -399,7 +398,7 @@ discard block |
||
| 399 | 398 | $words = explode('_', preg_replace( |
| 400 | 399 | '/([a-z0-9])([A-Z])/', |
| 401 | 400 | '$1_$2', |
| 402 | - preg_replace_callback('/([a-z0-9])?([A-Z]+)([A-Z][a-z])/', function ($d) { |
|
| 401 | + preg_replace_callback('/([a-z0-9])?([A-Z]+)([A-Z][a-z])/', function($d) { |
|
| 403 | 402 | return ($d[1] ? $d[1] . '_' : '') . $d[2] . '_' . $d[3]; |
| 404 | 403 | }, $name) |
| 405 | 404 | )); |
@@ -673,7 +672,7 @@ discard block |
||
| 673 | 672 | if (empty($associations)) { |
| 674 | 673 | $cols[] = $this->entityManager->escapeIdentifier($fkCol); |
| 675 | 674 | } |
| 676 | - $value = $entity->__get($hisVar); |
|
| 675 | + $value = $entity->__get($hisVar); |
|
| 677 | 676 | |
| 678 | 677 | if ($value === null) { |
| 679 | 678 | throw new IncompletePrimaryKey('Key incomplete to save foreign key'); |
@@ -719,7 +718,7 @@ discard block |
||
| 719 | 718 | $where = []; |
| 720 | 719 | |
| 721 | 720 | foreach ($myRelDef[self::OPT_RELATION_REFERENCE] as $myVar => $fkCol) { |
| 722 | - $value = $this->__get($myVar); |
|
| 721 | + $value = $this->__get($myVar); |
|
| 723 | 722 | |
| 724 | 723 | if ($value === null) { |
| 725 | 724 | throw new IncompletePrimaryKey('Key incomplete to save foreign key'); |
@@ -736,13 +735,13 @@ discard block |
||
| 736 | 735 | |
| 737 | 736 | $condition = []; |
| 738 | 737 | foreach ($oppRelDef[self::OPT_RELATION_REFERENCE] as $hisVar => $fkCol) { |
| 739 | - $value = $entity->__get($hisVar); |
|
| 738 | + $value = $entity->__get($hisVar); |
|
| 740 | 739 | |
| 741 | 740 | if ($value === null) { |
| 742 | 741 | throw new IncompletePrimaryKey('Key incomplete to save foreign key'); |
| 743 | 742 | } |
| 744 | 743 | |
| 745 | - $condition[] = $this->entityManager->escapeIdentifier($fkCol) .' = ' . |
|
| 744 | + $condition[] = $this->entityManager->escapeIdentifier($fkCol) . ' = ' . |
|
| 746 | 745 | $this->entityManager->escapeValue($value); |
| 747 | 746 | } |
| 748 | 747 | $where[] = implode(' AND ', $condition); |
@@ -897,8 +896,7 @@ discard block |
||
| 897 | 896 | |
| 898 | 897 | $foreignKey = []; |
| 899 | 898 | $reference = !isset($myRelDef[self::OPT_RELATION_TABLE]) ? |
| 900 | - array_flip($oppRelDef[self::OPT_RELATION_REFERENCE]) : |
|
| 901 | - $myRelDef[self::OPT_RELATION_REFERENCE]; |
|
| 899 | + array_flip($oppRelDef[self::OPT_RELATION_REFERENCE]) : $myRelDef[self::OPT_RELATION_REFERENCE]; |
|
| 902 | 900 | |
| 903 | 901 | foreach ($reference as $var => $fkCol) { |
| 904 | 902 | $value = $this->__get($var); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | '((?<class>[A-Za-z_][A-Za-z0-9_\\\\]*)::|(?<alias>[A-Za-z_][A-Za-z0-9_]+)\.)?' . |
| 112 | 112 | '(?<column>[A-Za-z_][A-Za-z0-9_]*)' . |
| 113 | 113 | '(?<a>$| |,|\))/', |
| 114 | - function ($match) { |
|
| 114 | + function($match) { |
|
| 115 | 115 | if ($match['class']) { |
| 116 | 116 | if (!isset($this->classMapping['byClass'][$match['class']])) { |
| 117 | 117 | throw new NotJoined("Class " . $match['class'] . " not joined"); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | return null; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - $data = $result->fetch(\PDO::FETCH_ASSOC); |
|
| 206 | + $data = $result->fetch(\PDO::FETCH_ASSOC); |
|
| 207 | 207 | |
| 208 | 208 | if (!$data) { |
| 209 | 209 | return null; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | }, array_values($data)); |
| 240 | 240 | |
| 241 | 241 | $statement = 'INSERT INTO ' . $this->escapeIdentifier($entity::getTableName()) . ' ' . |
| 242 | - '(' . implode(',', $cols) . ') VALUES (' . implode(',', $values) . ')'; |
|
| 242 | + '(' . implode(',', $cols) . ') VALUES (' . implode(',', $values) . ')'; |
|
| 243 | 243 | $pdo = $this->getConnection(); |
| 244 | 244 | |
| 245 | 245 | if ($useAutoIncrement && $entity::isAutoIncremented()) { |
@@ -306,8 +306,8 @@ discard block |
||
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | $statement = 'UPDATE ' . $this->escapeIdentifier($entity::getTableName()) . ' ' . |
| 309 | - 'SET ' . implode(',', $set) . ' ' . |
|
| 310 | - 'WHERE ' . implode(' AND ', $where); |
|
| 309 | + 'SET ' . implode(',', $set) . ' ' . |
|
| 310 | + 'WHERE ' . implode(' AND ', $where); |
|
| 311 | 311 | $this->getConnection()->query($statement); |
| 312 | 312 | |
| 313 | 313 | $this->sync($entity, true); |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | $statement = 'DELETE FROM ' . $this->escapeIdentifier($entity::getTableName()) . ' ' . |
| 340 | - 'WHERE ' . implode(' AND ', $where); |
|
| 340 | + 'WHERE ' . implode(' AND ', $where); |
|
| 341 | 341 | $this->getConnection()->query($statement); |
| 342 | 342 | |
| 343 | 343 | $entity->setOriginalData([]); |
@@ -230,11 +230,11 @@ discard block |
||
| 230 | 230 | { |
| 231 | 231 | $data = $entity->getData(); |
| 232 | 232 | |
| 233 | - $cols = array_map(function ($key) { |
|
| 233 | + $cols = array_map(function($key) { |
|
| 234 | 234 | return $this->escapeIdentifier($key); |
| 235 | 235 | }, array_keys($data)); |
| 236 | 236 | |
| 237 | - $values = array_map(function ($value) use ($entity) { |
|
| 237 | + $values = array_map(function($value) use ($entity) { |
|
| 238 | 238 | return $this->escapeValue($value); |
| 239 | 239 | }, array_values($data)); |
| 240 | 240 | |
@@ -440,11 +440,11 @@ discard block |
||
| 440 | 440 | break; |
| 441 | 441 | |
| 442 | 442 | case 'integer': |
| 443 | - return (string)$value; |
|
| 443 | + return (string) $value; |
|
| 444 | 444 | break; |
| 445 | 445 | |
| 446 | 446 | case 'double': |
| 447 | - return (string)$value; |
|
| 447 | + return (string) $value; |
|
| 448 | 448 | break; |
| 449 | 449 | |
| 450 | 450 | case 'boolean': |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | protected function createJoin($join, $tableName, $expression, $alias, $args, $empty) |
| 213 | 213 | { |
| 214 | 214 | $join = $join . ' ' . $tableName |
| 215 | - . ($alias ? ' AS ' . $alias : ''); |
|
| 215 | + . ($alias ? ' AS ' . $alias : ''); |
|
| 216 | 216 | |
| 217 | 217 | if (preg_match('/^[A-Za-z_]+$/', $expression)) { |
| 218 | 218 | $join .= ' USING (' . $expression . ')'; |
@@ -325,14 +325,14 @@ discard block |
||
| 325 | 325 | public function getQuery() |
| 326 | 326 | { |
| 327 | 327 | return 'SELECT ' |
| 328 | - . (!empty($this->modifier) ? implode(' ', $this->modifier) . ' ' : '') |
|
| 329 | - . ($this->columns ? implode(',', $this->columns) : '*') |
|
| 330 | - . ' FROM ' . $this->tableName . ($this->alias ? ' AS ' . $this->alias : '') |
|
| 331 | - . (!empty($this->joins) ? ' ' . reset($this->joins) : '') |
|
| 332 | - . (!empty($this->where) ? ' WHERE ' . implode(' ', $this->where) : '') |
|
| 333 | - . (!empty($this->groupBy) ? ' GROUP BY ' . implode(',', $this->groupBy) : '') |
|
| 334 | - . (!empty($this->orderBy) ? ' ORDER BY ' . implode(',', $this->orderBy) : '') |
|
| 335 | - . ($this->limit ? ' LIMIT ' . $this->limit . ($this->offset ? ' OFFSET ' . $this->offset : '') : ''); |
|
| 328 | + . (!empty($this->modifier) ? implode(' ', $this->modifier) . ' ' : '') |
|
| 329 | + . ($this->columns ? implode(',', $this->columns) : '*') |
|
| 330 | + . ' FROM ' . $this->tableName . ($this->alias ? ' AS ' . $this->alias : '') |
|
| 331 | + . (!empty($this->joins) ? ' ' . reset($this->joins) : '') |
|
| 332 | + . (!empty($this->where) ? ' WHERE ' . implode(' ', $this->where) : '') |
|
| 333 | + . (!empty($this->groupBy) ? ' GROUP BY ' . implode(',', $this->groupBy) : '') |
|
| 334 | + . (!empty($this->orderBy) ? ' ORDER BY ' . implode(',', $this->orderBy) : '') |
|
| 335 | + . ($this->limit ? ' LIMIT ' . $this->limit . ($this->offset ? ' OFFSET ' . $this->offset : '') : ''); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | /** {@inheritdoc} */ |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | } elseif ($empty) { |
| 226 | 226 | $this->joins[] = $join; |
| 227 | 227 | } else { |
| 228 | - return new Parenthesis(function (ParenthesisInterface $parenthesis) use ($join) { |
|
| 228 | + return new Parenthesis(function(ParenthesisInterface $parenthesis) use ($join) { |
|
| 229 | 229 | $join .= ' ON ' . $parenthesis->getExpression(); |
| 230 | 230 | $this->joins[] = $join; |
| 231 | 231 | return $this; |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | /** {@inheritdoc} */ |
| 309 | 309 | public function limit($limit) |
| 310 | 310 | { |
| 311 | - $this->limit = (int)$limit; |
|
| 311 | + $this->limit = (int) $limit; |
|
| 312 | 312 | |
| 313 | 313 | return $this; |
| 314 | 314 | } |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | /** {@inheritdoc} */ |
| 317 | 317 | public function offset($offset) |
| 318 | 318 | { |
| 319 | - $this->offset = (int)$offset; |
|
| 319 | + $this->offset = (int) $offset; |
|
| 320 | 320 | |
| 321 | 321 | return $this; |
| 322 | 322 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | /** {@inheritdoc} */ |
| 86 | 86 | public function andParenthesis() |
| 87 | 87 | { |
| 88 | - $parenthesis = new Parenthesis(function (ParenthesisInterface $parenthesis) { |
|
| 88 | + $parenthesis = new Parenthesis(function(ParenthesisInterface $parenthesis) { |
|
| 89 | 89 | $this->where[] = (!empty($this->where) ? 'AND ' : '') . $parenthesis->getExpression(); |
| 90 | 90 | |
| 91 | 91 | return $this; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | /** {@inheritdoc} */ |
| 98 | 98 | public function orParenthesis() |
| 99 | 99 | { |
| 100 | - $parenthesis = new Parenthesis(function (ParenthesisInterface $parenthesis) { |
|
| 100 | + $parenthesis = new Parenthesis(function(ParenthesisInterface $parenthesis) { |
|
| 101 | 101 | $this->where[] = (!empty($this->where) ? 'OR ' : '') . $parenthesis->getExpression(); |
| 102 | 102 | |
| 103 | 103 | return $this; |