public function addapiAction(Request $request)
 {
     /****** Admin session checking**********/
     $response = $this->checkAdmin($request->getSession());
     if ($response) {
         return $response;
     }
     $api = new ApiInfo();
     $em = $this->getDoctrine()->getManager();
     /******Fetch Api Gateway********/
     $query = $em->createQuery("SELECT p FROM MytripAdminBundle:ApiGateway  p ");
     $getapi = $query->getArrayResult();
     /*******Save API**********/
     if ($request->getMethod() == "POST") {
         $api->setApi($this->getDoctrine()->getRepository('MytripAdminBundle:ApiGateway')->find($request->request->get('apikey')));
         $api->setMetaKey($request->request->get('metakey'));
         $api->setMetaValue($request->request->get('metavalue'));
         $em->persist($api);
         $em->flush();
         $this->get('session')->getFlashBag()->add('error', '<div class="success msg">API successfully added</div>');
         return $this->redirect($this->generateUrl('mytrip_admin_addapi'));
     }
     return $this->render('MytripAdminBundle:Default:addapi.html.php', array('api' => $getapi));
 }
 /**
  * {@inheritDoc}
  */
 public function getApi()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getApi', array());
     return parent::getApi();
 }