re #108 use app main logger + multiple fixes

This commit is contained in:
Antonio Ramirez
2017-11-12 21:58:48 +01:00
parent 77430fbb74
commit 190fafa5f1
30 changed files with 100 additions and 63 deletions

View File

@ -14,6 +14,7 @@ namespace Da\User\Traits;
use Da\User\Helper\AuthHelper;
use Da\User\Helper\ClassMapHelper;
use Yii;
use yii\base\InvalidConfigException;
use yii\di\Container;
/**
@ -48,6 +49,8 @@ trait ContainerAwareTrait
/**
* @return \Da\User\Helper\AuthHelper|object
*
* @throws InvalidConfigException
*/
public function getAuth()
{
@ -56,6 +59,8 @@ trait ContainerAwareTrait
/**
* @return \Da\User\Helper\ClassMapHelper|object
*
* @throws InvalidConfigException
*/
public function getClassMap()
{

View File

@ -15,12 +15,10 @@ use Da\User\Event\MailEvent;
use Da\User\Model\User;
use Da\User\Service\MailService;
use Exception;
use yii\log\Logger;
use Yii;
/**
* @property MailService $mailService
* @property Logger $logger
* @author Kartik Visweswaran <kartikv2@gmail.com>
*/
trait MailAwareTrait
{
@ -42,7 +40,7 @@ trait MailAwareTrait
$this->mailService->run();
} catch (Exception $e) {
$event = $this->make(MailEvent::class, [$type, $user, $this->mailService, $e]);
$this->logger->log($e->getMessage(), Logger::LEVEL_ERROR);
Yii::error($e->getMessage(), 'usuario');
$user->trigger(MailEvent::EVENT_AFTER_SEND_MAIL, $event);
return false;
}