Update a entity and it`s associated table

this is my code,i want to update the blogs hits and the blogs associated table users test. its 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).


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