public function newAction(AddressInterface $address, FormView $formView, $isValid, $source = null)
{
if ($isValid) {
$translator = $this->get('translator');
$addressManager = $this->get('elcodi.object_manager.address');
$addressManager->persist($address);
$addressManager->flush();
$this->get('elcodi.wrapper.customer')->get()->addAddress($address);
$this->get('elcodi.object_manager.customer')->flush();
$message = $translator->trans('store.address.save.response_ok');
$this->addFlash('success', $message);
$redirectUrl = self::CHECKOUT_SOURCE == $source ? 'store_checkout_address' : 'store_address_list';
return $this->redirect($this->generateUrl($redirectUrl));
}
return $this->renderTemplate('Pages:address-edit.html.twig', ['address' => $address, 'form' => $formView]);
}