Skip to content
This repository was archived by the owner on May 12, 2022. It is now read-only.

Commit 2cae067

Browse files
author
Nik Barham
committed
........ more fixes :(
1 parent 29d115e commit 2cae067

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Automatorm/Orm/Data.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,12 @@ public function join($var, array $where = [])
383383
$clauses = [];
384384
if ($where) foreach ($where as $clause_column => $clause_value)
385385
{
386-
$clauses['`pivotjoin`.`' . $clause_column . '`'] = $clause_value;
386+
// Rewrite $where clauses to insert `pivotjoin` table in column name
387+
preg_match('/^([!=<>]*)([^!=<>]+)([!=<>]*)$/', $clause_column, $parts);
388+
$prefix = $parts[1] ?: $parts[3];
389+
$clause_column = $parts[2];
390+
391+
$clauses['`pivotjoin`.`' . $clause_column . '`' . $prefix] = $clause_value;
387392
}
388393

389394
$query->select(

0 commit comments

Comments
 (0)