diff --git a/Library/Phalcon/Mailer/Manager.php b/Library/Phalcon/Mailer/Manager.php index 23e538a90..8b023708d 100644 --- a/Library/Phalcon/Mailer/Manager.php +++ b/Library/Phalcon/Mailer/Manager.php @@ -26,6 +26,15 @@ /** * Class Manager * + * * + * $mailer = \Phalcon\Mailer\Manager($config); + * + * if need to set view engines + * $mailer->setViewEngines([ + * '.phtml' => 'Phalcon\Mvc\View\Engine\Php' + * ]); + * + * * @package Phalcon\Manager */ class Manager extends Component @@ -50,6 +59,11 @@ class Manager extends Component */ protected $view; + /** + * @var array + */ + protected $viewEngines = null; + /** * Create a new MailerManager component using $config for configuring * @@ -145,6 +159,16 @@ public function normalizeEmail($email) } } + /** + * set value of $viewEngines + * + * @param array $engines + */ + public function setViewEngines(array $engines) + { + $this->viewEngines = $engines; + } + /** * Configure MailerManager class * @@ -338,16 +362,8 @@ protected function getView() $view = $this->getDI()->get('\Phalcon\Mvc\View\Simple'); $view->setViewsDir($viewsDir); - if ($registeredEngines = $viewApp->getRegisteredEngines()) { - $engines = []; - foreach ($registeredEngines as $key => $engine) { - if (is_object($engine)) { - $engines[$key] = get_class($engine); - } else { - $engines[$key] = $engine; - } - } - $view->registerEngines($engines); + if ($this->viewEngines) { + $view->registerEngines($this->viewEngines); } $this->view = $view; diff --git a/Library/Phalcon/Traits/EventManagerTrait.php b/Library/Phalcon/Traits/EventManagerAwareTrait.php similarity index 100% rename from Library/Phalcon/Traits/EventManagerTrait.php rename to Library/Phalcon/Traits/EventManagerAwareTrait.php