php - cakePHP afterFind() Warning (2) -
i have problem in application problem in afterfind() function, here's code:
public function afterfind($results, $primary = false){ app::uses('cakesession', 'model/datasource'); $deplacement_id = cakesession::read('id-deplacement'); foreach($results $k=>$valeur){ $results[$k][$this->alias]['checked']='false'; foreach($valeur['realisation'] $v=> $val){ if($val['deplacement_id'] == $deplacement_id){ $results[$k][$this->alias]['checked'] = 'true'; } } } return $results; }
the code works fine if test $results variable debug() in model shows me want have problem comes view error:
warning (2): invalid argument supplied foreach() [app\model\pointerne.php, line 46] notice (8): undefined index: realisation [app\model\pointerne.php, line 46]
i deleted error if may debug() in core file 0 can not use debug function for testing variable.
thank help
Comments
Post a Comment