Last active
January 19, 2017 02:55
-
-
Save ryanellis/b76658c2974ef63e99066db8c94cfaa6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\HttpFoundation\Response; | |
/* INSIDE THE CONTROLLER */ | |
// the varaibles you want to dump out | |
$var1 = 'bar_1; | |
$var2 = 'bar_2; | |
// create the twig template | |
$template = $this->get('twig')->createTemplate('{{ dump(foo) }} {{ dump(foo2) }}'); | |
// render the template | |
$res = $template->render(['foo'=>$va1, 'foo2'=>$var2]); | |
// return a simple response and set the content with the rendered Twig template | |
$response = new Response(); | |
$response->setContent($_res); | |
$response->setStatusCode(Response::HTTP_OK); | |
return $response; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment