public function typeroomAction(Request $request)
    {
        $roomType = new RoomType();

        $form = $this->createForm("room_types", $roomType);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($roomType);
            $em->flush();
            $message = 'roomtype.add.success';
            if ($roomType->getId()) {
                $message = 'roomtype.edit.success';
            }

            $response = new JsonResponse();
            $data = array(
                'result' => 'ok',
                'message' => $message
            );
            $response->setData($data);

            return $response;
        }

        return $this->render('YdleHubBundle:Config:typeroom.html.twig', array(
            'form' => $form->createView()
        ));
    }
public function typeroomAction(Request $request)
    {
        $roomType = new RoomType();

        $form = $this->createForm("room_types", $roomType);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($roomType);
            $em->flush();
            $message = 'roomtype.add.success';
            if ($roomType->getId()) {
                $message = 'roomtype.edit.success';
            }

            $response = new JsonResponse();
            $data = array(
                'result' => 'ok',
                'message' => $message
            );
            $response->setData($data);

            return $response;
        }

        return $this->render('YdleHubBundle:Config:typeroom.html.twig', array(
            'form' => $form->createView()
        ));
    }
public function typeroomAction ( Request $ request ) { $ roomType = new RoomType ( ) ; $ form = $ this -> createForm ( "room_types" , $ roomType ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ roomType ) ; $ em -> flush ( ) ; $ message = 'roomtype.add.success' ; if ( $ roomType -> getId ( ) ) { $ message = 'roomtype.edit.success' ; } $ response = new JsonResponse ( ) ; $ data = array ( 'result' => 'ok' , 'message' => $ message ) ; $ response -> setData ( $ data ) ; return $ response ; } return $ this -> render ( 'YdleHubBundle:Config:typeroom.html.twig' , array ( 'form' => $ form -> createView ( ) ) ) ; }
Homepage for type room, listing and editing types

@param  \Symfony\Component\HttpFoundation\Request $request
@return type
Homepage for type room listing and editing types