@@ -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 | |
@@ -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([]); |
@@ -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} */ |
@@ -69,18 +69,18 @@ |
||
| 69 | 69 | *******************************************/ |
| 70 | 70 | try { |
| 71 | 71 | $fetcher = $em->fetch(User::class) |
| 72 | - ->where(User::class . '::username LIKE ?', 'USER_A') |
|
| 73 | - ->andWhere('password', '=', md5('password_a')) |
|
| 74 | - ->orParenthesis() |
|
| 75 | - ->where(User::class . '::username = ' . $em->getConnection()->quote('user_b')) |
|
| 76 | - ->andWhere('t0.password = \'' . md5('password_b') . '\'') |
|
| 77 | - ->close() |
|
| 78 | - ->groupBy('id') |
|
| 79 | - ->orderBy( |
|
| 80 | - 'CASE WHEN username = ? THEN 1 WHEN username = ? THEN 2 ELSE 3 END', |
|
| 81 | - 'ASC', |
|
| 82 | - ['user_a', 'user_b'] |
|
| 83 | - ); |
|
| 72 | + ->where(User::class . '::username LIKE ?', 'USER_A') |
|
| 73 | + ->andWhere('password', '=', md5('password_a')) |
|
| 74 | + ->orParenthesis() |
|
| 75 | + ->where(User::class . '::username = ' . $em->getConnection()->quote('user_b')) |
|
| 76 | + ->andWhere('t0.password = \'' . md5('password_b') . '\'') |
|
| 77 | + ->close() |
|
| 78 | + ->groupBy('id') |
|
| 79 | + ->orderBy( |
|
| 80 | + 'CASE WHEN username = ? THEN 1 WHEN username = ? THEN 2 ELSE 3 END', |
|
| 81 | + 'ASC', |
|
| 82 | + ['user_a', 'user_b'] |
|
| 83 | + ); |
|
| 84 | 84 | $users = $fetcher->all(); |
| 85 | 85 | |
| 86 | 86 | var_dump($users); |