I have a problem with CakePHP 3.0 which does not make sense to me and would like your help to be resolved. I have a table name called users with a controller named same (UsersController). I can view users in a table without any problems, but when I insert, modify or delete a user, I get an error.
When I do the insert, I get an error: call to function member () function in boolean UsersController.php on line 56
If I look at the controller class, it looks like
public function add() { $user = $this->Users->newEntity(); if ($this->request->is('post')) { $user = $this->Users->patchEntity($user, $this->request->data); if ($this->Users->save($user)) { $this->Flash->success(__('The user has been saved.')); return $this->redirect(['action' => 'index']); } else { $this->Flash->error(__('The user could not be saved. Please, try again.')); } } $this->set(compact('user')); $this->set('_serialize', ['user']); }
Line 56 is $ this-> Flash-> success (__ ('User was saved.'));
The user is inserted, updated or deleted from the database (depending on the requested action)
What puzzles me is why the code will return an error and, most importantly, how can I solve this?
Thanks so much for your time.
source share