Hi, i am working on a edit function in my UsersController but the value that i provide will not being updated inside of my database even if the object has got the correct value:
Controller:
$user->profile->image = $name;
debug($user);
exit;
}
}
if ($this->Users->save($user)) {
$this->Flash->success(__('The user has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The user could not be saved. Please, try again.'));
}
$this->set(compact('user'));
APP/Controller/UsersController.php (line 167)
object(App\Model\Entity\User) id:0 {
‘id’ => (int) 22
‘created’ => object(Cake\I18n\FrozenTime) id:1 { }
‘modified’ => object(Cake\I18n\FrozenTime) id:2 { }
‘profile’ => object(App\Model\Entity\Profile) id:3 {
‘id’ => (int) 20
‘user_id’ => (int) 22
‘name’ => ‘Mike’
‘image’ => ‘681668.jpg’
The value ‘image’ of the object is correct here but he does not write it into the database. If I change other values it will work fine. just the value that i write into the object with
$user->profile->image = $name; will not being updated inside of the database.