Forms Symfony3提交后需要刷新

Forms Symfony3提交后需要刷新,forms,redirect,submit,symfony,page-refresh,Forms,Redirect,Submit,Symfony,Page Refresh,我希望在提交表单后不要刷新我的页面 我使用重定向并再次请求实体列表,但没有更改,我仍然需要刷新。对于其他表单,我也遇到了同样的问题,但重定向解决了它 编辑: 我发现问题在于我直接调用视图,而无需从控制器重新加载。是否有方法调用控制器以呈现新资源?事实上,重定向仅从操作起作用,而不是从子函数起作用。 我只需对动作进行级联,并在需要时进行重定向,如: public function handleClient($client) { if (!$client->getNom() || !$

我希望在提交表单后不要刷新我的页面

我使用重定向并再次请求实体列表,但没有更改,我仍然需要刷新。对于其他表单,我也遇到了同样的问题,但重定向解决了它

编辑:
我发现问题在于我直接调用视图,而无需从控制器重新加载。是否有方法调用控制器以呈现新资源?

事实上,重定向仅从操作起作用,而不是从子函数起作用。 我只需对动作进行级联,并在需要时进行重定向,如:

public function handleClient($client)
{
    if (!$client->getNom() || !$this->clientForm->isSubmitted() || !$this->clientForm->isValid())
        return false;

    $this->getDoctrine()->getManager()->persist($client);
    $this->getDoctrine()->getManager()->flush();

    // HANDLE REFRESH LIST OF CLIENT EXPECTED
    $repository = $this->getDoctrine()->getManager()->getRepository('CommonBundle:Client');
    $this->listClients = $repository->getAllClientInverse();

    $this->redirect($this->generateUrl('accueil'));
    return true;
}


public function clientAction(Request $request)
{
    // ACCUEIL
    $repository = $this->getDoctrine()->getManager()->getRepository('CommonBundle:Client');
    $this->listClients = $repository->getAllClientInverse();

    // HANDLE CLIENT CREATION AND REQUEST
   if ($this->handleClient())
        $this->redirect($this->generateUrl('accueil'));

    $repository = $this->getDoctrine()->getManager()->getRepository('CommonBundle:Client');
    $this->listClients = $repository->getAllClientInverse();

    return $this->render('CommonBundle:Default:index.html.twig',
        array('listClients' => $this->listClients)
        );
    }
}

我仍然有这个问题。我试过使用$this->redirectToRoute('acueil',array(),302/301);没有变化。
public function handleClient($client)
{
    if (!$client->getNom() || !$this->clientForm->isSubmitted() || !$this->clientForm->isValid())
        return false;

    $this->getDoctrine()->getManager()->persist($client);
    $this->getDoctrine()->getManager()->flush();

    // HANDLE REFRESH LIST OF CLIENT EXPECTED
    $repository = $this->getDoctrine()->getManager()->getRepository('CommonBundle:Client');
    $this->listClients = $repository->getAllClientInverse();

    $this->redirect($this->generateUrl('accueil'));
    return true;
}


public function clientAction(Request $request)
{
    // ACCUEIL
    $repository = $this->getDoctrine()->getManager()->getRepository('CommonBundle:Client');
    $this->listClients = $repository->getAllClientInverse();

    // HANDLE CLIENT CREATION AND REQUEST
   if ($this->handleClient())
        $this->redirect($this->generateUrl('accueil'));

    $repository = $this->getDoctrine()->getManager()->getRepository('CommonBundle:Client');
    $this->listClients = $repository->getAllClientInverse();

    return $this->render('CommonBundle:Default:index.html.twig',
        array('listClients' => $this->listClients)
        );
    }
}