Skip to content

Commit 1650fa6

Browse files
committed
Implement buildSortingSelectSQL() API
This is required for compatibility with Symphony 2.7.x, which bring compatibility with MySQL 5.7 strict mode. The code is a copy of the logic from buildSortingSQL, which should be refactored when dropping pre 2.7.0 compatibility Re: #84
1 parent cb32bb0 commit 1650fa6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

fields/field.selectbox_link.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,33 @@ public function buildSortingSQL(&$joins, &$where, &$sort, $order='ASC'){
995995
}
996996
}
997997

998+
public function buildSortingSelectSQL($sort, $order = 'ASC')
999+
{
1000+
if ($this->isRandomOrder($order)) {
1001+
return null;
1002+
}
1003+
$sort = array();
1004+
$joinnedFieldSchema = array();
1005+
$joinnedFieldsId = $this->getRelatedFieldsId();
1006+
1007+
foreach ($joinnedFieldsId as $key => $joinnedFieldId) {
1008+
$joinnedFieldSchema = $this->getFieldSchema($joinnedFieldId);
1009+
1010+
if (empty($joinnedFieldSchema)) {
1011+
// bail out
1012+
return;
1013+
}
1014+
$joinnedFieldSchema = current($joinnedFieldSchema);
1015+
$sortColumn = $joinnedFieldSchema['Field'];
1016+
$sort[] = "`jd_$key`.`$sortColumn`";
1017+
}
1018+
1019+
if (!empty($sort)) {
1020+
return implode(',', $sort);
1021+
}
1022+
return null;
1023+
}
1024+
9981025
/*-------------------------------------------------------------------------
9991026
Grouping:
10001027
-------------------------------------------------------------------------*/

0 commit comments

Comments
 (0)