src/Dpavic/JobsBundle/Controller/JobController.php
/**
     * Creates a new Job entity.
     *
     * @Route("/", name="job_create")
     * @Method("POST")
     * @Template("DpavicJobsBundle:Job:new.html.twig")
     */
Creates a new Job entity.
Creates a new Job entity .
public function createAction(Request $request)
    {
        $entity = new Job();
        $form = $this->createForm(new JobType(), $entity);
        $form->bind($request);
        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();
            return $this->redirect($this->generateUrl('job_preview', array(
                                'company' => $entity->getCompanySlug(),
                                'location' => $entity->getLocationSlug(),
                                'token' => $entity->getToken(),
                                'position' => $entity->getPositionSlug()
            )));
        }
        return array(
            'entity' => $entity,
            'form' => $form->createView(),
        );
    }
public function createAction ( Request $ request ) { $ entity = new Job ( ) ; $ form = $ this -> createForm ( new JobType ( ) , $ entity ) ; $ form -> bind ( $ request ) ; if ( $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ entity ) ; $ em -> flush ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'job_preview' , array ( 'company' => $ entity -> getCompanySlug ( ) , 'location' => $ entity -> getLocationSlug ( ) , 'token' => $ entity -> getToken ( ) , 'position' => $ entity -> getPositionSlug ( ) ) ) ) ; } return array ( 'entity' => $ entity , 'form' => $ form -> createView ( ) , ) ; }
Creates a new Job entity.
Creates a new Job entity .