public function actionSigninPlatform() { if (!Yii::app()->user->isGuest) { $this->redirect('/'); } $user = new Users('signin'); if (isset($_POST['Users'])) { $user->attributes = $_POST['Users']; } $user->role = Users::ROLE_PLATFORM; $user->status = Users::STATUS_MODERATION; $platform = new Platforms('signin'); if (isset($_POST['Platforms'])) { $platform->attributes = $_POST['Platforms']; } $platform->is_active = 0; if (isset($_POST['Users']) && isset($_POST['Platforms'])) { $user->validate(); $platform->validate(); if (!$user->hasErrors() && !$platform->hasErrors()) { $transaction = $user->getDbConnection()->beginTransaction(); if ($user->save(false)) { $platform->user_id = $user->id; if ($platform->save(false)) { SMail::sendMail(Yii::app()->params['registrationEmail'], 'Регистрация пользователя ' . $user->email, 'SignInRequest', array('user' => $user)); $transaction->commit(); $this->redirect(array('users/signinSuccess')); } } $transaction->rollback(); } } $this->render('signin_platform', array('user' => $user, 'platform' => $platform)); }