我在cakePHP 2.我有一個問題,我需要你的幫助。這裏是我的控制器(從StudentsController.php)的一些代碼,特別是「編輯」功能:按變量篩選選定列表
$students = $this -> Student -> find('list', array(
'order' => 'Student.name ASC'
));
$this -> set('students', $students);
如何過濾當前學生的班級列表,以便該列表將包含具有相同的學生的所有學生類?
我需要這樣的
$students = $this -> Student -> find('list', array(
'conditions' => array('Student.class_id' => CURRENT-STUDENT'S-CLASS),
'order' => 'Student.name ASC'
));
$this -> set('students', $students);
所以你有你正在編輯的學生的編號?你如何獲得當前的學生類ID –
嗨科爾比,我需要用正確的代碼替換** CURRENT-STUDENT'S-CLASS **,但我不知道:( – gonzo
顯示您的整個編輯功能 –