i have action, when send data, have
request-uri long. requested url's length exceeds capacity limit server
public function addaction(request $request) { $productgallery = new productgallery(); $product = new product(); $productgallery->addproductgallerytoproduct($product); $form = $this->createform(new productgallerytype(), $productgallery); if($request->ismethod('post')) { $form->handlerequest($request); if($form->isvalid()) { $em = $this->getdoctrine()->getmanager(); $em->persist($productgallery); $em->persist($product); $em->flush(); return $this->redirecttoroute('addaction', array('form' => $form->createview())); } } return array( 'form' => $form->createview() ); } how can fixed it? wrong?
p.s form collection
public function buildform(formbuilderinterface $builder, array $options) { $builder ->add('productgallery_to_product', 'collection', array( 'type' => new producttype(), 'allow_add' => true, 'by_reference' => false, 'allow_delete' => true, 'prototype' => true )) ; } new info
method 'post' in url
you're passing whole form view object in url:
$this->redirecttoroute('addaction', array('form' => $form->createview())); the second argument redirecttoroute() list of parameters send request.
this makes url long. exceeds web server limit, in turn refuses handle request.
your call should more this:
$this->redirecttoroute('addaction'); also, first argument redirecttoroute() method route name, not action method name. replace unless route name "addaction".
read more in controller chapter of documentation.
Comments
Post a Comment