From cd974daab07161327da6ca65cd408dfd1e6589da Mon Sep 17 00:00:00 2001 From: Mr Ceperka Date: Thu, 10 Dec 2020 15:53:42 +0100 Subject: [PATCH 1/2] Update QueryBuilderTest.joins.phpt --- tests/cases/unit/QueryBuilderTest.joins.phpt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/cases/unit/QueryBuilderTest.joins.phpt b/tests/cases/unit/QueryBuilderTest.joins.phpt index c0d078c1..edb8e2d0 100644 --- a/tests/cases/unit/QueryBuilderTest.joins.phpt +++ b/tests/cases/unit/QueryBuilderTest.joins.phpt @@ -15,13 +15,21 @@ class QueryBuilderJoinsTest extends QueryBuilderTestCase [ 'SELECT * FROM one AS [o] ' . 'LEFT JOIN two AS [t] ON (o.userId = t.userId) ' . + 'LEFT JOIN %table ON (%table.id = tbl.t1_id) ' . + 'LEFT JOIN %table ON (%table.id = tbl.t2_id) ' . 'INNER JOIN three AS [th] ON (t.userId = th.userId) ' . - 'RIGHT JOIN four AS [f] ON (th.userId = f.userId)' + 'RIGHT JOIN four AS [f] ON (th.userId = f.userId)', + 't1', + 't1', + 't2', + 't2' ], $this->builder() ->from('one', 'o') ->select('*') ->joinLeft('two AS [t]', 'o.userId = t.userId') + ->joinLeft('%table', '%table.id = tbl.t1_id', 't1', 't1') + ->joinLeft('%table', '%table.id = tbl.t2_id', 't2', 't2') ->joinInner('three AS [th]', 't.userId = th.userId') ->joinRight('four AS [f]', 'th.userId = f.userId') ); From c0f4faf68f8da1c44f099f5028b6075d0a48e92d Mon Sep 17 00:00:00 2001 From: Mr Ceperka Date: Thu, 10 Dec 2020 16:00:37 +0100 Subject: [PATCH 2/2] Possible fix --- src/QueryBuilder/QueryBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/QueryBuilder/QueryBuilder.php b/src/QueryBuilder/QueryBuilder.php index a124ebf5..2e0dd185 100644 --- a/src/QueryBuilder/QueryBuilder.php +++ b/src/QueryBuilder/QueryBuilder.php @@ -294,7 +294,7 @@ public function removeJoins(): self private function join(string $type, string $toExpression, string $onExpression, array $args): self { $this->dirty(); - $this->join[$toExpression] = [ + $this->join[] = [ 'type' => $type, 'table' => $toExpression, 'on' => $onExpression,