for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Zenstruck\ControllerUtil\EventListener;
use Symfony\Component\Templating\EngineInterface;
use Zenstruck\ControllerUtil\View;
/**
* @author Kevin Bond <[email protected]>
*/
class TemplatingViewListener extends ViewListener
{
protected $templating;
public function __construct(EngineInterface $templating)
$this->templating = $templating;
}
* {@inheritdoc}
protected function getContent(View $view, $format)
$template = $view->getTemplate();
if (is_array($template)) {
foreach ($template as $t) {
if ($this->templating->exists($t)) {
$template = $t;
break;
return $this->templating->render($template, $view->getDataAsArray());
protected function supports(View $view, $format)
return null !== $view->getTemplate();