2017-06-01 1 views
1

Je viens de faire mon premier projet de test après quelques années et .. Je suis confus.Méthode inconnue "saveAll"

public function add() 
{ 
    $post = $this->Posts->newEntity(); 
    if ($this->request->is('post')) { 
     $post = $this->Posts->patchEntity($post, $this->request->getData()); 
     if ($this->Posts->saveAll($post)) { 
      $this->Flash->success(__('The post has been saved.')); 

      return $this->redirect(['action' => 'index']); 
     } 
     $this->Flash->error(__('The post could not be saved. Please, try again.')); 
    } 
    $parentPosts = $this->Posts->ParentPosts->find('list', ['limit' => 200]); 
    $this->set(compact('post', 'parentPosts')); 
    $this->set('_serialize', ['post']); 
} 

Après avoir soumis la forme je reçois

méthode inconnue "saveAll"

BadMethodCallException

Tout ce que j'ai changé est

$this->Posts->save($post) 

(qui fonctionne très bien) à

$this->Posts->saveAll($post) 

Pourquoi cette méthode est inconnue ici? C'est pareil avec saveAssociated et etc. Merci!

Répondre