• support@answerspoint.com

Warning (2): Illegal offset type [CORE\Cake\Model\Model.php, line 3054]

3029

I have a question please help me thanks..
my cake php is 2.7.0 and i use wamp ver 2.4 , but i get this error.

cakephp-Warning (2): Illegal offset type [CORE\Cake\Model\Model.php, line 3054]

Warning (2): Illegal offset type [CORE\Cake\Model\Model.php, line 3054]

My veiw is:

public function edit($id=null) {
    if(!$id) {      
        $this->Session->setFlash('not found this job');
        $this->redirect(array('action'=>'index'),null,true);

    }
    if(empty($this->data)) {
        $this->data=$this->Menu->find(array('all',array('conditions'=>array('id'=>$id))));
    } else {            
        if($this->Task->save($this->data)) {
            $this->Session->setFlash('updated');

            $this->redirect(array('action'=>'index'),null,true);
        } else {
            $this->Session->setFlash('this up date has problem !!! ');
        }

    }
}

and my controller is:

public function edit($id=null) {
    if(!$id) {      
        $this->Session->setFlash('not found this job');
        $this->redirect(array('action'=>'index'),null,true);

    }
    if(empty($this->data)) {
        $this->data=$this->Menu->find(array('all',array('conditions'=>array('id'=>$id))));
    } else  {

        if($this->Menu->save($this->data)) {
            $this->Session->setFlash('updated');
            $this->redirect(array('action'=>'index'),null,true);

        } else {
            $this->Session->setFlash('this up date has problem !!! ');
        }

    }


}

Pleae help me

1Answer


0

You are using Model::find() wrong, what should be passed as separate arguments is wrapped in an array.

It has to be

find('all', array('conditions' => /* ... */));

not

find(array('all', array('conditions' => /* ... */)));
  • answered 8 years ago
  • B Butts

Your Answer

    Facebook Share        
       
  • asked 9 years ago
  • viewed 3029 times
  • active 9 years ago

Best Rated Questions