From d6e0782e1636b7ea391723baeb2a1d7e0e899c09 Mon Sep 17 00:00:00 2001 From: sergeysviridenko Date: Fri, 20 Oct 2017 14:52:10 +0300 Subject: [PATCH 1/2] Fixed view engines in mailer --- Library/Phalcon/Mailer/Manager.php | 36 +++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 10 deletions(-) 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; From ca7bc06d1a182c7b77d80f5b84c518c75863d4e5 Mon Sep 17 00:00:00 2001 From: Richard Browne Date: Sun, 22 Oct 2017 22:06:21 +0100 Subject: [PATCH 2/2] #835 - Rename of EventManagerTrait to EventManagerAwareTrait --- .../Traits/{EventManagerTrait.php => EventManagerAwareTrait.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Library/Phalcon/Traits/{EventManagerTrait.php => EventManagerAwareTrait.php} (100%) 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