
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()
]);
}
{
$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>
{{ 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?