cakephp - sort on array read -


in controller have

var $uses = array('user','customer'); 

then using read call users

$loggedoutcustomer = $this->user->read(null, $this->auth->user('id')); 

this gives me users , cutsomers can use want sort on customers name. how can in cake?

you can set default order in user model.

if customer belongsto user, user hasmany customer.

in user model, under hasmany variable, find customer record , add customer.name order array key.

also, please remove cakephp version tag not using.

you can add sorting options when you're using find() method of model.

this can defined in pagination array

another option use containable behavior


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -