added console commands

This commit is contained in:
Antonio Ramirez
2016-12-11 01:20:10 +01:00
parent 1ebe58d2ce
commit 76e49ca1a7
5 changed files with 155 additions and 2 deletions

View File

@ -2,6 +2,7 @@
namespace Da\User\Service;
use Da\User\Contracts\ServiceInterface;
use Da\User\Event\UserEvent;
use Da\User\Helper\SecurityHelper;
use Da\User\Model\User;
use yii\base\InvalidCallException;
@ -43,7 +44,7 @@ class UserCreateService implements ServiceInterface
? $model->password
: $this->securityHelper->generatePassword(8);
$model->trigger(ActiveRecord::EVENT_BEFORE_INSERT);
$model->trigger(UserEvent::EVENT_BEFORE_CREATE);
if (!$model->save()) {
$transaction->rollBack();
@ -51,7 +52,7 @@ class UserCreateService implements ServiceInterface
return false;
}
$model->trigger(ActiveRecord::EVENT_AFTER_INSERT);
$model->trigger(UserEvent::EVENT_AFTER_CREATE);
$this->mailService->run();
$transaction->commit();