Olá,
Sou novo no Yii e instalei a extensão Yii-User, aparentemente está funcionando normalmente, mas tenho uma dúvida: Para cadastrar usuários existe o registration (index.php?r=User/Registration) e o (index.php?r=User/admin/create), o último só o usuário com poderes de admin pode acessar. Qual seria a diferença entre eles se teoricamente os dois criam usuário na tabela Users? E ao tentar cadastrar por meio do User/admin/create ocorre um erro (texto abaixo). Sei que é algo com o Profile. Se puderem ajudar…
ERRO apontado na linha 85.
PHP notice
Undefined index: Profile
/var/www/teste-extension/protected/modules/user/controllers/AdminController.php(85)
73 * Creates a new model.
74 * If creation is successful, the browser will be redirected to the ‘view’ page.
75 */
76 public function actionCreate()
77 {
78 $model=new User;
79 $profile=new Profile;
80 $this->performAjaxValidation(array($model,$profile));
81 if(isset($_POST[‘User’]))
82 {
83 $model->attributes=$_POST[‘User’];
84 $model->activkey=Yii::app()->controller->module->encrypting(microtime().$model->password);
85 $profile->attributes=$_POST[‘Profile’]; //linha do erro
86 $profile->user_id=0;
87 if($model->validate()&&$profile->validate()) {
88 $model->password=Yii::app()->controller->module->encrypting($model->password);
89 if($model->save()) {
90 $profile->user_id=$model->id;
91 $profile->save();
92 }
93 $this->redirect(array(‘view’,‘id’=>$model->id));
94 } else $profile->validate();
95 }
96
97 $this->render(‘create’,array(