Issue Bug Closed

#70677Sorting of foreign records in TCA type select

Christian Fries 10/14/15, 10:21 updated 02/27/20, 12:41

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.

Reviews 4