From 40d1ea560c2d5930ad6e527a8321784dd9336e33 Mon Sep 17 00:00:00 2001 From: Ciki Date: Mon, 14 Nov 2016 18:50:34 +0100 Subject: [PATCH] use sql alias for columns suggested from joined table --- src/DataSources/DibiFluent.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DataSources/DibiFluent.php b/src/DataSources/DibiFluent.php index f0910f52..cc0f5c27 100644 --- a/src/DataSources/DibiFluent.php +++ b/src/DataSources/DibiFluent.php @@ -162,7 +162,7 @@ public function suggest($column, array $conditions, $limit) { $fluent = clone $this->fluent; if (is_string($column)) { - $fluent->removeClause('SELECT')->select("DISTINCT %n", $column)->orderBy("%n", $column, 'ASC'); + $fluent->removeClause('SELECT')->select("DISTINCT %n AS v", $column)->orderBy("%n", $column, 'ASC'); } foreach ($conditions as $condition) { @@ -173,7 +173,7 @@ public function suggest($column, array $conditions, $limit) $data = $fluent->fetchAll(0, $limit); foreach ($data as $row) { if (is_string($column)) { - $value = (string) $row[$column]; + $value = (string) $row['v']; } elseif (is_callable($column)) { $value = (string) $column($row); } else {