this is my code,i want to update the blogs hits and the blog
s associated table users test. it
s just a example.
$blog = $this->Blog->get($id, [ 'contain' => ['User'] ]); $blog->hits +=1; $blog->user->test = time(); $res = $this->Blog->save($blog,['associated' =>['User']]);
You need to set $blog->user
as being dirty - $blog->dirty('user', true)
.
2 Likes
yes, i see the doc.and i set a wrong entity name, i set Users.Now i see.thank you.
Your answer helped me a lot. Thanks