/** * @param \Symfony\Component\HttpFoundation\Request $request * * @return array|\Symfony\Component\HttpFoundation\RedirectResponse */ public function addAction(Request $request) { $form = $this->getFactory()->createCarrierForm()->handleRequest($request); if ($form->isValid()) { $data = $form->getData(); $carrierTransfer = new ShipmentCarrierTransfer(); $carrierTransfer->fromArray($data, true); $this->getFacade()->createCarrier($carrierTransfer); return $this->redirectResponse('/shipment'); } return $this->viewResponse(['form' => $form->createView()]); }