bug in caching model

check this

$model=Book::model()->with(‘author’)->findByPk(1);

$model->author_id=2

$model->save();

print "direct author id = ".$model->author_id;

print "relation author id = ".$model->author->id;

this bug is reported #2562

Yii does never update any related models automatically. It’s up to you to think about an apropriate logic to do so. Hence i would not consider this a bug.