Bug #20425
closedctrl-section option 'sortby' => 'myfield DESC', causes SQL-error on saving a new record
0%
Description
I created a table via extMgr and changed the sortby option in ext_tables.php to
'sortby' => 'mysortfield DESC'
On saving the INSERT will look like this:
INSERT INTO tx_myable (field1, field2, mysortfield DESC, field3) VALUES ...
Of cause DESC will lead to an SQL error here.
(issue imported from #M11090)
Updated by Christian Kuhn over 15 years ago
Resolved, no change required:
According to the documentation [1] the sortby field must only contain a fieldname. Use the default_sortby field if you want explicit ASC / DESC sorting. Documentation quote:
"default_sortby" => "ORDER BY title",
"default_sortby" => "ORDER BY tstamp DESC",
"default_sortby" => "ORDER BY parent,crdate DESC",
The em will also produce such a config.
[1] http://typo3.org/documentation/document-library/core-documentation/doc_core_api/4.2.0/view/4/2/