1

I'm developing with Symfony2, I want to send the variable myDate to my custom page 503 (error503.html.twig).

{# error503.html.twig #}

{% if myDate is not null or myDate is not empty %}
    Start date : {{ myDate }}
{% else %}
 {{ render(controller('MyBundle:myController:index')) }}
{% endif %}

When the service is not available, the page 503 is displayed, but the variables are not sent to this page from the controller. I tried with the render template and it does not work (no error, just no variable that appears).

/** myController.php **/

public function indexAction()
{
...
 return $this->render('TwigBundle:views:Exception:error503.html.twig', array(
        'myDate' => $startDate, 
     )); 
...
}

I specify that it works with 403, 404 ... but not with the 503 exception . Thanks for your help.

doulouM
  • 41
  • 6
  • 1
    First show us a code example and structure your logic, so we can understand you more easily and help you in the process. – Boian Ivanov Jan 23 '18 at 11:01
  • If your server is 503, are you sure your symfony app is up? what does give you a `dump($startDate);exit;` in your controller `indexAction` method? – goto Jan 23 '18 at 16:00
  • Yes, my Symfony app is up when the 503 exception is thrown. A dump($startDate); die(); return the value of $startDate but this value can't be sent to the view. – doulouM Jan 23 '18 at 16:21

0 Answers0