re #108 use app main logger + multiple fixes
This commit is contained in:
@ -20,7 +20,6 @@ use Da\User\Traits\MailAwareTrait;
|
||||
use Da\User\Traits\ModuleAwareTrait;
|
||||
use Exception;
|
||||
use yii\base\InvalidCallException;
|
||||
use yii\log\Logger;
|
||||
use Yii;
|
||||
|
||||
class UserRegisterService implements ServiceInterface
|
||||
@ -31,14 +30,12 @@ class UserRegisterService implements ServiceInterface
|
||||
protected $model;
|
||||
protected $securityHelper;
|
||||
protected $mailService;
|
||||
protected $logger;
|
||||
|
||||
public function __construct(User $model, MailService $mailService, SecurityHelper $securityHelper, Logger $logger)
|
||||
public function __construct(User $model, MailService $mailService, SecurityHelper $securityHelper)
|
||||
{
|
||||
$this->model = $model;
|
||||
$this->mailService = $mailService;
|
||||
$this->securityHelper = $securityHelper;
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
public function run()
|
||||
@ -49,7 +46,7 @@ class UserRegisterService implements ServiceInterface
|
||||
throw new InvalidCallException('Cannot register user from an existing one.');
|
||||
}
|
||||
|
||||
$transaction = $model->getDb()->beginTransaction();
|
||||
$transaction = $model::getDb()->beginTransaction();
|
||||
|
||||
try {
|
||||
$model->confirmed_at = $this->getModule()->enableEmailConfirmation ? null : time();
|
||||
@ -91,7 +88,7 @@ class UserRegisterService implements ServiceInterface
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
$transaction->rollBack();
|
||||
$this->logger->log($e->getMessage(), Logger::LEVEL_ERROR);
|
||||
Yii::error($e->getMessage(), 'usuario');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user