- WIP on Collation

This commit is contained in:
mcndave committed 2024-12-16 18:46:24 +00:00
1 parent b601939459
commit b5e96eb7e0
8 files changed
+61 -11

No files matched your search

+3 -2
View File
@@ -8,6 +8,7 @@ class OrderBy extends Fragment {
public array $orderBy = [];
const SQL_TOKEN = "ORDER BY";
const SQL_COLLATE = "COLLATE";
public function set(array $order) : self
{
@@ -16,7 +17,7 @@ class OrderBy extends Fragment {
return $this;
}
public function add(object|string $field, ? string $direction = null) : self
public function add(string|\Stringable $field, ? string $direction = null) : self
{
$this->validateFieldType($field);
@@ -30,7 +31,7 @@ class OrderBy extends Fragment {
$list = array_map(function($item) {
list($field, $direction) = $item;
return $field . ( $direction ? " $direction" : "" );
return implode(' ', array_filter([ $field , $direction ?? null ] ));
}, $this->orderBy);
return $this->renderSegments([