Deprecation: Deprecated since 3.3, use TemplateResponse instead.
Author: Ross Riley (riley.ross@gmail.com)
Inheritance: extends Symfony\Component\HttpFoundation\Response
Example #1
0
 /**
  * Render a template, possibly store it in cache. Or, if applicable, return the cached result.
  *
  * @param string $template the template name
  * @param array  $vars     array of context variables
  * @param array  $globals  array of global variables
  *
  * @return mixed
  */
 public function render($template, $vars = array(), $globals = array())
 {
     // Start the 'stopwatch' for the profiler.
     $this->app['stopwatch']->start('bolt.render', 'template');
     $response = BoltResponse::create($this->app[$this->twigKey]->loadTemplate($template), $vars, $globals);
     // Stop the 'stopwatch' for the profiler.
     $this->app['stopwatch']->stop('bolt.render');
     return $response;
 }
Example #2
0
 /**
  * Render a template, possibly store it in cache. Or, if applicable, return the cached result.
  *
  * @param string $template the template name
  * @param array  $vars     array of context variables
  * @param array  $globals  array of global variables
  *
  * @return \Bolt\Response\BoltResponse
  */
 public function render($template, $vars = [], $globals = [])
 {
     $response = BoltResponse::create($this->app[$this->twigKey]->loadTemplate($template), $vars, $globals);
     $response->setStopwatch($this->app['stopwatch']);
     return $response;
 }
Example #3
0
 public function testGetTemplateName()
 {
     $app = $this->getApp();
     $response = BoltResponse::create($app['twig']->loadTemplate('error.twig'), []);
     $this->assertEquals('error.twig', $response->getTemplateName());
 }