i have a cart controller. in add and remove methods i change products that are stored in session and redirect back to cart page.
the problem i have that on production environment it works only one time and then does nothing like it caches redirects and ignores logic.(cart page just refreshes like nothing was changed)
/**
* @Route("/", name="cart_index")
* @param Request $request
* @return array
*/
public function indexAction(Request $request)
{
$cart = $this->get('cart');
$products = $cart->getProductPages();
//output cart
}
/**
* @Route("/add/{id}", name="cart_add")
* @param $id
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function addAction($id)
{
$this->get('cart')->addProduct($id);
return $this->redirect($this->generateUrl('cart_index'));
}
/**
* @Route("/remove/{id}", name="cart_remove")
* @param $id
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function removeAction($id)
{
$this->get('cart')->removeProduct($id);
return $this->redirect($this->generateUrl('cart_index'));
}
and the most interesting that it even ignores the request
on the dev environment everything works great.