public function beforeSave() { if (!$this->isNewRecord && $this->owner_id != Yii::app()->user->id) { throw404(); } return parent::beforeSave(); }