Skip to content

Commit aeda807

Browse files
committed
Fixing PostgreSQL dialect in MagicQuery
1 parent d81f854 commit aeda807

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/QueryFactory/SmartEagerLoad/Query/StaticPartialQuery.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66

77
use Doctrine\DBAL\Connection;
8+
use Doctrine\DBAL\Platforms\AbstractPlatform;
89
use Doctrine\DBAL\Platforms\MySqlPlatform;
910
use Mouf\Database\MagicQuery;
1011
use TheCodingMachine\TDBM\QueryFactory\SmartEagerLoad\StorageNode;
@@ -68,7 +69,9 @@ public function getQueryFrom(): string
6869
$sql .= implode(', ', $tables);
6970
$sql .= ' '.$this->queryFrom;
7071

72+
$this->magicQuery->setOutputDialect($mysqlPlatform);
7173
$sql = $this->magicQuery->build($sql, $this->parameters);
74+
$this->magicQuery->setOutputDialect(null);
7275
$fromIndex = strpos($sql, 'FROM');
7376
if ($fromIndex === false) {
7477
throw new TDBMException('Expected smart eager loader query to contain a "FROM"');

0 commit comments

Comments
 (0)