ReZa
ReZa

Reputation: 347

CakePHP containable, group by in containable

I have a table called People

Like this:

ID    BillID    FirstName    LastName
1       1           x            y
2       1           z            t
3       2           v            w

The relation is one to many (each Bill has many People)

so I want to paginate this way:

I want to have all people of (for instance) 5 different Bills in each page

How should I make the query?!

Upvotes: 1

Views: 187

Answers (1)

Confused
Confused

Reputation: 1662

Did you tried group by clause?

In cakephp use below line in

$this->Paginator->settings

'group' => array('billid') 

Upvotes: 1

Related Questions