I’m on cakePHP 2. I have a problem and I need your help. Here is some code of my controller (from StudentsController.php) specifically the “edit” function:
$students = $this -> Student -> find('list', array(
'order' => 'Student.name ASC'
));
$this -> set('students', $students);
How can I filter the list by the current student’s class so the list will contain all students that has the same student’s class?
I need some code like this
$students = $this -> Student -> find('list', array(
'conditions' => array('Student.class_id' => CURRENT-STUDENT'S-CLASS),
'order' => 'Student.name ASC'
));
$this -> set('students', $students);
So according to your edit function, your find should look something like this.
));