Skip to content

Commit 38c74ec

Browse files
committed
Fixing PGSql dialect for sub-queries
1 parent 0871a5d commit 38c74ec

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
],
2020
"require" : {
2121
"php" : ">=7.1",
22-
"mouf/magic-query" : "^1.3.0",
22+
"mouf/magic-query" : "^1.4.0",
2323
"mouf/schema-analyzer": "^1.1.4",
2424
"doctrine/dbal": "^2.9.2",
2525
"psr/log": "~1.0",

src/ResultIterator.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,14 @@ class ResultIterator implements Result, \ArrayAccess, \JsonSerializable
4949
private $objectStorage;
5050
private $className;
5151

52+
/**
53+
* @var TDBMService
54+
*/
5255
private $tdbmService;
5356
private $parameters;
57+
/**
58+
* @var MagicQuery
59+
*/
5460
private $magicQuery;
5561

5662
/**
@@ -363,7 +369,12 @@ public function withParameters(array $parameters) : ResultIterator
363369
*/
364370
public function _getSubQuery(): string
365371
{
366-
$sql = $this->magicQuery->build($this->queryFactory->getMagicSqlSubQuery(), $this->parameters);
372+
$this->magicQuery->setOutputDialect(new MySqlPlatform());
373+
try {
374+
$sql = $this->magicQuery->build($this->queryFactory->getMagicSqlSubQuery(), $this->parameters);
375+
} finally {
376+
$this->magicQuery->setOutputDialect($this->tdbmService->getConnection()->getDatabasePlatform());
377+
}
367378
$primaryKeyColumnDescs = $this->queryFactory->getSubQueryColumnDescriptors();
368379

369380
if (count($primaryKeyColumnDescs) > 1) {

vendor-bin/couscous/composer.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)