Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Symfony]Symfony 3, POST zachowuje sie jak GET, i po RedirecTtoRoute zostaje jakis string w pasku URL
fumfel20
post
Post #1





Grupa: Zarejestrowani
Postów: 48
Pomógł: 0
Dołączył: 17.09.2015

Ostrzeżenie: (0%)
-----


Witam, w sumie to dopiero zaczynam z Symfony (wczesniej tylko Laravel) i napotykam na probemy ktorych wczesniej nie mialem. Mam prosty formularz z 3 inputami i po wyslaniu ich do bazy danych po Redirekcie pasek adresu wyglada tak:

(IMG:http://i68.tinypic.com/3166deo.png)

Metoda w kontrolerze:
Kod
public function getInventoryShipmentLocationAction(Request $request)
    {
        $form = $this->createForm(InvShipLocFormType::class);

        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()){
            //dump($request);die;
            $inventory = $request->request->get('inv_ship_loc_form')['inventory'];
            $shipment = $request->request->get('inv_ship_loc_form')['shipment'];
            $location = $request->request->get('inv_ship_loc_form')['location'];
            $product = $this->getProductInformation($inventory, $shipment)[0];
            $partNo = $product['PART_NO'];
            $customerOrder = $product['C_CUST_PO_NO'];
            $defaultepickLication = $product['EPICKLOCATION'];

            $pickInLocation = new sendProductToLocation();
            $pickInLocation->setIntInventoryNo($inventory);
            $pickInLocation->setIntShipmentNo($shipment);
            $pickInLocation->setIntCustomerOrder($customerOrder);
            $pickInLocation->setStrPartNo($partNo);
            $pickInLocation->setStrDefaultEpickLocation($defaultepickLication);
            $pickInLocation->setStrLocation($location);
            $pickInLocation->setCreatedAt(new \DateTime());
            $em = $this->getDoctrine()->getManager();
            $em->persist($pickInLocation);
            $em->flush();
            return $this->redirectToRoute('devonSendToLocation',[
                'InvShipLocForm'=> $form->createView()
            ]);

        }

        return $this->render('devonSendToLocation/index.html.twig',[
            'InvShipLocForm'=> $form->createView()
        ]);
    }


formularz:
Kod
<div class="container">
        {{ form_start(InvShipLocForm, { 'attr' : { 'autocomplete': 'off'} }) }}
        {{ form_widget(InvShipLocForm) }}
        <button class="btn btn-default" type="submit">SEND</button>
        {{ form_end(InvShipLocForm) }}
    </div>


Co robie nie tak?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 26.09.2025 - 09:02