src/AppBundle/Controller/User/ClientController.php
/**
     * Creates a new client entity.
     *
     * @Route("/new", name="client_new")
     * @Method({"GET", "POST"})
     */
Creates a new client entity.
Creates a new client entity .
public function newAction(Request $request)
    {
        $client = new Client();
        $form = $this->createForm('AppBundle\Form\User\ClientType', $client);
        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($client);
            $em->flush();
            return $this->redirectToRoute('client_index', array('id' => $client->getId()));
        }
        return $this->render('user/client/new.html.twig', array(
            'client' => $client,
            'form' => $form->createView(),
        ));
    }
public function newAction ( Request $ request ) { $ client = new Client ( ) ; $ form = $ this -> createForm ( 'AppBundle\Form\User\ClientType' , $ client ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ client ) ; $ em -> flush ( ) ; return $ this -> redirectToRoute ( 'client_index' , array ( 'id' => $ client -> getId ( ) ) ) ; } return $ this -> render ( 'user/client/new.html.twig' , array ( 'client' => $ client , 'form' => $ form -> createView ( ) , ) ) ; }
Creates a new client entity.
Creates a new client entity .