Close #269 added help for console commands + php-cs-fixer

This commit is contained in:
tonydspaniard
2019-06-29 08:32:35 +02:00
parent d4695a60d2
commit 8c551d9030
27 changed files with 123 additions and 85 deletions

View File

@ -59,6 +59,7 @@ class UserCreateService implements ServiceInterface
? $model->password
: $this->securityHelper->generatePassword(8);
/** @var UserEvent $event */
$event = $this->make(UserEvent::class, [$model]);
$model->trigger(UserEvent::EVENT_BEFORE_CREATE, $event);
@ -75,15 +76,15 @@ class UserCreateService implements ServiceInterface
['email' => $model->email]
);
// from web display a flash message (if enabled)
if($this->getModule()->enableFlashMessages == TRUE && is_a(Yii::$app, yii\web\Application::class)) {
if ($this->getModule()->enableFlashMessages === true && is_a(Yii::$app, yii\web\Application::class)) {
Yii::$app->session->setFlash(
'warning',
$error_msg
);
}
// if we're from console add an error to the model in order to return an error message
if(is_a(Yii::$app, yii\console\Application::class)) {
$model->addError("username", $error_msg);
if (is_a(Yii::$app, yii\console\Application::class)) {
$model->addError('username', $error_msg);
}
$transaction->rollBack();
return false;