Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #81 from Elao/from-symfony-templating-to-twig
Browse files Browse the repository at this point in the history
From symfony templating to twig
  • Loading branch information
benji07 authored Sep 10, 2018
2 parents c064383 + 032e92e commit 50c226e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
20 changes: 10 additions & 10 deletions Listener/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Templating\EngineInterface;
use Twig_Environment;

/**
* Notifier
Expand All @@ -34,9 +34,9 @@ class Notifier
private $mailer;

/**
* @var EngineInterface
* @var Twig_Environment
*/
private $templating;
private $twig;

/**
* @var string
Expand Down Expand Up @@ -66,15 +66,15 @@ class Notifier
/**
* The constructor
*
* @param Swift_Mailer $mailer mailer
* @param EngineInterface $templating templating
* @param string $cacheDir cacheDir
* @param array $config configure array
* @param Swift_Mailer $mailer mailer
* @param Twig_Environment $twig twig
* @param string $cacheDir cacheDir
* @param array $config configure array
*/
public function __construct(Swift_Mailer $mailer, EngineInterface $templating, $cacheDir, $config)
public function __construct(Swift_Mailer $mailer, Twig_Environment $twig, $cacheDir, $config)
{
$this->mailer = $mailer;
$this->templating = $templating;
$this->twig = $twig;
$this->from = $config['from'];
$this->to = $config['to'];
$this->handle404 = $config['handle404'];
Expand Down Expand Up @@ -330,7 +330,7 @@ public function createMailAndSend($exception, Request $request = null, $context
return;
}

$body = $this->templating->render('ElaoErrorNotifierBundle::mail.html.twig', array(
$body = $this->twig->render('ElaoErrorNotifierBundle::mail.html.twig', array(
'exception' => $exception,
'request' => $request ? $this->filterRequest($request): null,
'status_code' => $exception->getCode(),
Expand Down
2 changes: 1 addition & 1 deletion Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<tag name="kernel.event_listener" event="console.exception" method="onConsoleException" priority="0"/>
<tag name="kernel.event_listener" event="console.command" method="onConsoleCommand" priority="0"/>
<argument type="service" id="mailer" />
<argument type="service" id="templating" />
<argument type="service" id="twig" />
<argument>%kernel.cache_dir%</argument>
<argument>%elao.error_notifier.config%</argument>
</service>
Expand Down
10 changes: 6 additions & 4 deletions Twig/DumpyTwigFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

use Elao\ErrorNotifierBundle\Exception\InvokerException;
use Symfony\Component\Yaml\Dumper as YamlDumper;
use Twig_Extension;
use Twig_SimpleFilter;

/**
* Extends Twig with
Expand All @@ -36,7 +38,7 @@
*
* @author Goutte
*/
class DumpyTwigFilter extends \Twig_Extension
class DumpyTwigFilter extends Twig_Extension
{
/** @const INLINE : default value for the inline parameter of the YAML dumper aka the expanding-level */
const INLINE = 3;
Expand All @@ -51,9 +53,9 @@ public function getFilters()
$optionsForRaw = array('is_safe' => array('all')); // allows raw dumping (otherwise <pre> is encoded)

return array(
'pre' => new \Twig_SimpleFilter('pre', array($this, 'pre'), $optionsForRaw),
'dump' => new \Twig_SimpleFilter('dump', array($this, 'preDump'), $optionsForRaw),
'dumpy' => new \Twig_SimpleFilter('dumpy', array($this, 'preYamlDump'), $optionsForRaw),
'pre' => new Twig_SimpleFilter('pre', array($this, 'pre'), $optionsForRaw),
'dump' => new Twig_SimpleFilter('dump', array($this, 'preDump'), $optionsForRaw),
'dumpy' => new Twig_SimpleFilter('dumpy', array($this, 'preYamlDump'), $optionsForRaw),
);
}

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"php": ">=5.3.2",
"symfony/framework-bundle": "~2.3|~3.0",
"symfony/console": "~2.3|~3.0",
"symfony/twig-bundle": "~2.3|~3.0",
"swiftmailer/swiftmailer": "~5.0|~6.0"
},

Expand Down

0 comments on commit 50c226e

Please sign in to comment.