-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Unknown
-
Affects Version/s: None
-
None
Query\Grammar::prepareFieldsForQuery() renames a->b to a.b by assigning the new key and unsetting the old one:
$values[$newKey] = $value; unset($values[$key]);
For a sort specification this appends the renamed key, so orderBy('traits->colour')->orderBy('name') is sent as {"name": 1, "traits.colour": 1} and the requested primary sort silently becomes the last tie-breaker. Fix: rebuild the array preserving the original key position (same for the .id to ._id rename). Add a test with two sort keys.
Filament feature this fixes: sortable columns on embedded-document attributes (TextColumn::make('traits.colour')>sortable()). Filament rewrites the dot path to traits>colour and always appends a secondary default sort, so the user's sort is lost on every such column.
- related to
-
PHPLARA-292 SPIKE: Investigate Filament support
-
- Closed
-