Добавлено событие о изменении email адреса пользователя, вызовы методов для генерации уведомлений внесены внутрь транзакции бд

This commit is contained in:
ErickSkrauch
2016-07-17 18:42:37 +03:00
parent 6d3db89140
commit dd0c4fcc9e
4 changed files with 55 additions and 13 deletions

View File

@ -11,6 +11,7 @@ use common\models\confirmations\RegistrationConfirmation;
use common\models\EmailActivation;
use common\validators\LanguageValidator;
use common\validators\PasswordValidate;
use Exception;
use Ramsey\Uuid\Uuid;
use Yii;
use yii\base\ErrorException;
@ -68,6 +69,7 @@ class RegistrationForm extends ApiForm {
/**
* @return Account|null the saved model or null if saving fails
* @throws Exception
*/
public function signup() {
if (!$this->validate()) {
@ -97,15 +99,15 @@ class RegistrationForm extends ApiForm {
$this->sendMail($emailActivation, $account);
$changeUsernameForm = new ChangeUsernameForm();
$changeUsernameForm->createEventTask($account->id, $account->username, null);
$transaction->commit();
} catch (ErrorException $e) {
} catch (Exception $e) {
$transaction->rollBack();
throw $e;
}
$changeUsernameForm = new ChangeUsernameForm();
$changeUsernameForm->createEventTask($account->id, $account->username, null);
return $account;
}