The generated prepareQuery function now looks like this:
/**
* Preparation of the list query.
*
* @access protected
* @param object &$query returns a filled query object.
*
* @return void
*/
protected function prepareQuery(&$query)
{
//FROM : Main table
$query->from('#__test_users AS a');
// Automatic composition of the base query from ORM description
$this->populateStatesOrm();
$this->orm(array(
'select' => array(
'created_by',
'published'
),
'access' => array(
'a' => array(
'publish' => 'published',
'author' => 'created_by'
)
),
'filter' => array(
'creation_date' => array(
'type' => 'range'
),
'modification_date' => array(
'type' => 'range'
)
)
));
// Apply all SQL directives to the query
$this->applySqlStates($query);
}
However, the "created by" filter reloads the page but displays the same results as the previous selection. Only when:
'created_by' => array(
'type' => 'fk'
),
is added to the filter array does the selection box change the displayed results.
The filter array would now look like:
'filter' => array(
'created_by' => array(
'type' => 'fk'
),
'creation_date' => array(
'type' => 'range'
),
'modification_date' => array(
'type' => 'range'
)
)
and would work as expected