Voici le code de ma fonction "edit"

public function edit($id = null) {
    $this->Post->id = $id;
    $this->helpers] = 'MediaManager.Uploader';  
    //Save all the data for the database
    if ($this->request->is('put') || $this->request->is('post')){
        if ($this->Post->saveAll($this->data)) {
            $this->Session->setFlash('Your post has been updated.');
            $this->redirect(array('action' => 'manage'));
        }else{
            $this->Session->setFlash('Unable to update your post.');
        }
    }elseif($id){ 
        $this->Post->id = $id;
        $this->set('post', $this->Post->read());
        $this->request->data = $this->Post->read();
    }else{
        $user = $this->Session->read('UserAuth.User.username');
        $this->request->data = $this->Post->getDraft($user);    
    }
}

2 réponses


palmer08
Réponse acceptée

As-tu essaié de mettre $this->request->data à la place de $this->data ?

et ...?