Example #1
0
 public function postView($ip, $categorie, $post = null)
 {
     $em = $this->getDoctrine()->getManager();
     $viewRepo = $em->getRepository('TerAelisStatistiquesBundle:View');
     $view = $viewRepo->findOneBy(array('ip' => $ip, 'categorie' => $categorie, 'post' => $post));
     if ($view == null) {
         $view = new View($ip, $post);
     } else {
         $view->setCount($view->getCount() + 1);
     }
     $em->persist($view);
     $em->flush();
     return true;
 }