Added controller

This commit is contained in:
Chris 2017-12-30 00:53:52 +01:00
parent 26942cdbde
commit 3937e57344

View File

@ -0,0 +1,32 @@
<?php
namespace NoccyLabs\Bundle\PdfBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use NoccyLabs\Bundle\PdfBundle\Pdf\PdfGenerator;
/**
* @Route("/noccylabs/pdf")
*/
class DefaultController extends Controller
{
protected $generator;
public function setGenerator(PdfGenerator $generator)
{
$this->generator = $generator;
}
/**
* @Route("/test")
*/
public function indexAction()
{
$generator = $this->get("noccylabs.pdf.generator");
$html = $this->renderView('NoccyLabsPdfBundle:Example:example.html.twig');
return $generator->generateResponseFromHtml($html);
}
}