I am using CakePHP 3.x and I am trying to sort my data on containable data that I need for my paginator to be able to sort on it.
I have the following options for my paginator:
public function getEventSignupsOptionsForPagination($id)
{
$options = array(
'limit' => 30,
'conditions' => array(
'event_id' => $id
),
'order' => array(
'signup_date' => 'asc'
),
'contain' => array(
'Users',
'Events.Instances.DkpLists.DkpListEntries.Users'
),
'sortWhitelist' => array(
'Users.username',
'Events.Instances.DkpLists.DkpListEntries.current',
'message',
'status',
'signup_date'
)
);
return $options;
}
This set of options returns the correct data. But when I try to sort on it, it gives an error.
I use the following line to sort in my view:
<?php echo $this->Paginator->sort('Events.Instances.DkpLists.DkpListEntries.current', 'DKP'); ?>
This works, untill I click on it, then I get the following error:
Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Events.Instances' in 'order clause'
I don't understand why this is going wrong, because it can retrieve the proper data, but it can't sort on it.