Added controller
This commit is contained in:
parent
26942cdbde
commit
3937e57344
32
src/Controller/DefaultController.php
Normal file
32
src/Controller/DefaultController.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user