public function indexAction(Request $request)
 {
     $session = $request->getSession();
     $em = $this->getDoctrine()->getManager();
     $reposity = $em->getRepository('ApiMapBundle:Logindata');
     if ($request->getMethod() == 'POST') {
         $session->clear();
         $user = $request->get('username');
         $passward = $request->get('passward');
         $remember = $request->get('remember');
         $userdata = $reposity->findOneBy(array('name' => $user, 'passward' => $passward));
         if ($userdata) {
             if ($remember === 'remember-me') {
                 $login = new Logindata();
                 $login->setName($user);
                 $login->setPassward($passward);
                 $session->set('login', $login);
             }
             return $this->render('ApiMapBundle:Default:welcome.html.twig', array('name' => $userdata->getName()));
         } else {
             return $this->render('ApiMapBundle:Default:login.html.twig', array('name' => 'Login Error Try again...'));
         }
     } else {
         if ($session->has('login')) {
             $login = $session->get('login');
             $username = $login->getName();
             $passward = $login->getPassward();
             $userdata = $reposity->findOneBy(array('name' => $username, 'passward' => $passward));
             if ($userdata) {
                 $unitids_data = $this->getTableEnteries();
                 return $this->render('ApiMapBundle:Default:welcome.html.twig', array('name' => $userdata->getName(), 'unitsids' => $unitids_data));
             }
         }
     }
     return $this->render('ApiMapBundle:Default:login.html.twig');
 }
 /**
  * {@inheritDoc}
  */
 public function setName($name)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setName', array($name));
     return parent::setName($name);
 }