Example #1
0
 public function write($session_id, $session_data)
 {
     $session = $this->app->getStore()->getManager()->getRepository('systemBundle:RaptorSession')->findOneBy(array('name' => $session_id));
     if ($session) {
         $session->setData($session_data);
         $session->setTime(time());
         $this->app->getStore()->getManager()->persist($session);
     } else {
         $session = new \Raptor\Component\systemBundle\Model\Entity\RaptorSession();
         $session->setName($session_id);
         $session->setData($session_data);
         $session->setTime(time());
         $this->app->getStore()->getManager()->persist($session);
     }
     $this->app->getStore()->getManager()->flush();
     return true;
 }