/** * После вставки пользователя, назначим ему необходимые роли */ public function _cmsSavePhone() { if ($this->_phone) { if ($this->cmsUserPhone) { $this->cmsUserPhone->value = $this->_phone; $this->cmsUserPhone->def = Cms::BOOL_Y; $this->cmsUserPhone->save(); } else { $cmsUserPhone = new CmsUserPhone(['value' => $this->_phone, 'def' => Cms::BOOL_Y]); $cmsUserPhone->save(); $cmsUserPhone->link('user', $this); } } }