A
A
Alexander2018-09-03 15:31:07
MODX
Alexander, 2018-09-03 15:31:07

Modx getResources doesn't sort. Am I not using Fenom+getResources correctly?

I am using Collection. I want to get an array. But sorting doesn't work.
{var $resources = $_modx->getResources(
['published' => 1],
['parents' => 27],
['includeTVs' => 1],
['processTVs' => 1],
['includeContent ' => 1],
['sortby' => 'pagetitle', 'sortdir' => 'DESC'],
['debug' => 1]
)}
Only two options are displayed in Debug:

{$_modx->getResources("Array ( [published] => 1 )", Array ( [parents] => 27 ) )}

Where are the rest of the settings?
If I swap the parameters and put them upstairs, ['sortby' => 'pagetitle', 'sortdir' => 'DESC'],
I get an error: [pdoTools] Could not load collection of "modResource": Error 42S22: Unknown column 'modResource.sortby' in 'where clause
'
works.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kafeuri1989, 2018-09-07
@kafeuri1989

['sortby' => 'pagetitle', 'sortdir' => 'DESC'],
You need to write like this
['sortby' => 'pagetitle'],
['sortdir' => 'DESC']
and not together

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question