I have a News model and a Files model. News has the connection 'files'=>array(self::HAS_ONE, 'Files', 'news_id') . I need to get one news, do the things I need with it and add the file to the linked table files. I try to do this:
$model=News::model()->findByPk($_GET['id']); $model->files = new Files; $model->files->name = "Имя файла"; $model->save() It is possible to edit the received news, but the record in the files table is not added. Tell me what I'm doing wrong?