Skip to content

Commit

Permalink
SqlBuilder: Fixed loading arguments for left join conditions (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
norbe authored and dg committed Apr 12, 2019
1 parent d81e35e commit a45e10a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Database/Table/SqlBuilder.php
Expand Up @@ -585,6 +585,9 @@ protected function getSortedJoins(string $table, &$leftJoinDependency, &$tableJo
}
$finalJoins += $tableJoins[$table];
$key = isset($this->aliases[$table]) ? $table : $this->reservedTableNames[$table];
if ($key[0] === '.') {
$key = substr($key, 1);
}
$this->parameters['joinConditionSorted'] += isset($this->parameters['joinCondition'][$key])
? [$table => $this->parameters['joinCondition'][$key]]
: [];
Expand Down
7 changes: 7 additions & 0 deletions tests/Database/Table/SqlBuilder.parseJoinConditions().phpt
Expand Up @@ -89,3 +89,10 @@ test(function () use ($context, $driver) {
}
Assert::same([2, 'private'], $sqlBuilder->getParameters());
});

test(function () use ($context) {
$sqlBuilder = new SqlBuilderMock('book', $context);
$sqlBuilder->addJoinCondition('next_volume.author', 'next_volume.author.born >', '2000-01-01');

Assert::same(['2000-01-01'], $sqlBuilder->getParameters());
});

0 comments on commit a45e10a

Please sign in to comment.