public function addfeatureAction(Request $request)
 {
     /****** Admin session checking**********/
     $response = $this->checkAdmin($request->getSession());
     if ($response) {
         return $response;
     }
     $feature = new Feature();
     $feature_content = new FeatureContent();
     $em = $this->getDoctrine()->getManager();
     /*******Feature add*****/
     if ($request->getMethod() == "POST") {
         /********Checking duplicate username***********/
         $query = $em->createQuery("SELECT p FROM MytripAdminBundle:Feature p WHERE p.feature = '" . $request->request->get('feature') . "'");
         $checkfeature = $query->getArrayResult();
         if (empty($checkfeature)) {
             if ($request->files->get('icon') != '') {
                 $ext = $request->files->get('icon')->getClientOriginalExtension();
                 $filename = $this->str_rand(8, "alphanum") . "." . $ext;
                 $request->files->get('icon')->move("img/feature_icon", $filename);
                 $feature->setIcon($filename);
             }
             $feature->setFeature($request->request->get('feature'));
             $em->persist($feature);
             $em->flush();
             $em = $this->getDoctrine()->getManager();
             $lastid = $feature->getFeatureId();
             $feature_content->setFeature2($this->getDoctrine()->getRepository('MytripAdminBundle:Feature')->find($lastid));
             $feature_content->setFeature($request->request->get('feature'));
             $feature_content->setLan('en');
             $em->persist($feature_content);
             $em->flush();
             $this->get('session')->getFlashBag()->add('error', '<div class="success msg">Feature successfully added</div>');
             return $this->redirect($this->generateUrl('mytrip_admin_features'));
         } else {
             $this->get('session')->getFlashBag()->add('error', '<div class="error msg">Feature already exists</div>');
             //return $this->redirect($this->generateUrl('mytrip_admin_features'));
         }
     }
     return $this->render('MytripAdminBundle:Default:addfeature.html.php');
 }
 /**
  * {@inheritDoc}
  */
 public function getCreatedDate()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getCreatedDate', array());
     return parent::getCreatedDate();
 }