1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
   |  
    public function indexAction()
    {
        $session = new Session();
 
 
        if ($session->get('valid')=='true'){
        $em = $this->getDoctrine()->getManager();
 
        $entities = $em->getRepository('ProjectCRMBundle:Account')->findAll();
 
        return $this->render('ProjectCRMBundle:Account:index.html.twig', array(
            'entities' => $entities,
        ));}
        else
        { return $this->redirect($this->generateUrl('user_login'));}
 
    }
 
    public function newAction()
    {
        $session = new Session();
 
 
        if ($session->get('valid')=='true'){
 
        $entity = new Account();
        $form   = $this->createForm(new AccountType(), $entity);
 
        return $this->render('ProjectCRMBundle:Account:new.html.twig', array(
            'entity' => $entity,
            'form'   => $form->createView(),
        ));}
        else
        { return $this->redirect($this->generateUrl('user_login'));}
 
 
    } | 
Partager