Cake3 ORM Question: Is there a trick to avoid MySQL keyword errors in SQL strings?
I get a "1064 You have an error in your SQL syntax" error when I try to update my users table.
UPDATE users SET group = 'admin', modified = '2016-06-27 15:45:02' WHERE id = 2
How can I add the table name users.group to the SQL string to avoid the keyword error?
Controller.action (efault)
public function edit($id = null)
{
$user = $this->Users->get($id);
if ($this->request->is(['patch', 'post', 'put'])) {
$user = $this->Users->patchEntity($user, $this->request->data);
if ($this->Users->save($user)) {
$this->Flash->success(__('The Entry has been saved.'));
return $this->redirect(['action' => 'index']);
} else {
$this->Flash->error(__('The Entry could not be saved. Please, try again.'));
}
}
$this->set(compact('user', 'contacts', 'userLists'));
$this->set('_serialize', ['user']);
}