Example #1
0
 public function write($id, $data)
 {
     $repository = $this->entityManager->getRepository(Session::class);
     $session = $repository->find($id);
     if (!$session) {
         $session = new Session($id, $this->getUserAgent(), $this->getRemoteAddress());
     }
     $session->setData($data);
     $session->setLastModified(new DateTime());
     $session->setLifetime($this->lifetime);
     $this->entityManager->persist($session);
     $this->entityManager->flush($session);
     return true;
 }
Example #2
0
 public function __construct(Session $value)
 {
     $this->sessionId = $value->getId();
     $this->creationDate = $value->getCreationDate();
     $this->lastModified = $value->getLastModified();
     $this->lifetime = $value->getLifetime();
     $this->userAgent = $value->getUserAgent();
     $this->remoteAddress = $value->getRemoteAddress();
 }