php - Cakephp 3 newEntity() not working -
i have maintenance cakephp 3 project , in project, have create newentity
using array variable , data not save database. set print_r
result of usermodel
doesn't show anything.
i using nginx server (not apache), mysql 5.6, cakephp 3.
here code used.
$usermodel = $this->newentity($tabledata); print_r($usermodel); if (!$usermodel->errors()) { $result = $this->save($usermodel); if ($result) { return $result->id; } } else { return false; }
there 2 things need check first.
- try outputting $tabledata variable , ensuring elements in match against data structure have model object you're trying create.
- to manipulate entity. should calling using $this->modelname->newentity($tabledata); $this->modelname->save($usermodel)
Comments
Post a Comment