0

Situation

using Cake 3.2.6

What I want

To display a list of PaymentsByMembers by the members' role_id in ascending order followed by their name

In other words I want to order the primary models by the associated data fields.

What I tried

   $this->paginate = [
        'contain' => [
            'Issuers', 
            'Recipients', 'PaymentTypes'
        ],
        'conditions' => $conditions, 
        'order' => ['Recipients.role_id' => 'ASC', 'Recipients.name' => 'ASC']
    ];

what's the relations?

A Payments by Member belongsTo a Recipient

What did you find?

I can only find a section in the cookbook about filtering by associated data.

There is no equivalent about ordering by associated data.

I will be happy to write that in.

Kim Stacks
  • 10,202
  • 35
  • 151
  • 282
  • please explain the relationships between your models – arilia Apr 14 '16 at 06:55
  • Possible duplicate of [How to sort external fields using Paginator in CakePHP 3](http://stackoverflow.com/questions/31916341/how-to-sort-external-fields-using-paginator-in-cakephp-3) – ndm Apr 14 '16 at 11:09

0 Answers0