Symfony 2 Forward Request passing along GET/POST params

后端 未结 4 2115
醉酒成梦
醉酒成梦 2021-01-04 09:26

Is it possible to forward a request, passing along all GET/POST params?

I think if I just do

$this->forward(\'dest\')

I will g

4条回答
  •  滥情空心
    2021-01-04 09:48

    Easiest solution (and one I'd probably go for) would be to just pass Request class as forward parameter

    public function indexAction()
    {
        $request = $this->getRequest();
    
        return $this->forward('AcmeBundle:Forward:new', array('request' => $request));
    }
    

    And in forwarded action just use it as method param:

    public function testAction($request)
    {
        var_dump($request);exit;
    }
    

提交回复
热议问题