$response->withRedirect Does not show data that has been pass to the slim twig template engine

348 views Asked by At

I am trying to get the data($errors) from the Array I pass into my slim\twig template using

$response->withRedirect($this->router->pathFor($event->getRoute(),$errors )),

but when I do a twig {{dump()}} i get null,

However if I do "return $this->view->render($response,$event->getRoute(),$errors);" and then dump it works I get the data i need.

I am wondering how to do it with the $response->withRedirect in slim3.

I looked around The slim\twig github (https://github.com/slimphp/Twig-View) but I couldn't find the document on how to pass The array over to twig using the $response->withRedirect or for my insanity is it just perfectly fine using $this->view->render

my slim 3 view setup is

$container['view']=function($container){
    $view =  new \Slim\Views\Twig('../app/Views',['cache' => false,'debug' => true]);
    $view->addExtension(new \Slim\Views\TwigExtension(
        $container->router, 
        $container->request->getUri()
        ));

        $view->addExtension(new \Twig_Extension_Debug());
    return $view;
};

Thank you.

0

There are 0 answers