Bug #70677
closed
Sorting of foreign records in TCA type select
Added by Christian Fries about 9 years ago.
Updated over 4 years ago.
Description
Currently records of a foreign table won't be sorted in a select field if foreign_table_where doesn't contain an "ORDER BY ..." statement.
I'd suggest the following solution:
- Introduce a new option 'foreign_table_sortby'
- If 'foreign_table_sortby' is defined, use this statement for sorting
- Backward compatibility: If 'foreign_table_where' contains an 'ORDER BY ...' statement and 'foreign_table_sortby' is undefined, use the 'ORDER BY ...' statement as 'foreign_table_sortby'. If 'foreign_table_sortby' is defined, ignore 'ORDER BY ...' statements in 'foreign_table_where'
- If 'foreign_table_sortby' is not defined, use 'default_sortby' of the foreign table
In the long term this is a cleaner solution and if no sorting is defined, the records are sorted according to the default sorting.
- Tracker changed from Feature to Bug
- Category set to Backend API
- Target version set to next-patchlevel
- TYPO3 Version set to 8
- PHP Version set to 7.1
I just came over a similar problem: the default_sortby is a date field (start_date) and it works fine, if it is used as the standard sorting mechanism of the table. But as soon as it is used as the right table of an m:m relation, things don't work as nicely any more, when the TCA does NOT define an ORDER BY. As soon as there is an "ORDER BY start_date" it works as expected - but it is "double the trouble".
I would say: if there is no ORDER BY, then the standard sorting mechanism of the table should be used.
(I am not so sure if the intrdocution of a new sorting mechanism is necessary...)
TYPO3 8.7.1, php 7.1.13, MAMP with opcache
- Target version changed from next-patchlevel to Candidate for patchlevel
- Status changed from New to Under Review
- Related to Task #88933: Cleanup foreign_table_where directives added
- Related to deleted (Task #88933: Cleanup foreign_table_where directives)
- Blocks Task #88933: Cleanup foreign_table_where directives added
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Related to Bug #90127: ambiguous column name title when editing content elements added
- Status changed from Resolved to Closed
Also available in: Atom
PDF