Wonder why saving is failing
I am doing
$article = $this->Articles->newEntity($this->request->data);
if ($this->Articles->save($article)) {
$this->Session->setFlash(__('Your article has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Session->setFlash(__('Unable to add your article.'));
debug($this->request->data);
gives
[
'title' => 'Test Title',
'body' => 'This is the body'
]
but debug($article);
give
object(Cake\ORM\Entity) {
'new' => null,
'accessible' => [],
'properties' => [],
'dirty' => [],
'virtual' => [],
'errors' => []
}
What can possibly be wrong. I am guessing the title and body should appear as properties of the newly created entity without which the saving will not happen
I did a composer update just now - so I do have the latest code.
Cheers
Tarique
=============================================================
The Conference Schedule Creator : http://shdlr.com
PHP for E-Biz : http://sanisoft.com
=============================================================
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment