juzna

Untitled

Jan 16th, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. <?php
  2.  
  3. class MyUserStorage {
  4. ...
  5.  
  6.     public function setIdentity(IIdentity $identity = NULL) {
  7.         // ukladma pouze id
  8.         $this->getSessionSection(TRUE)->identityId = $identity ? $identity->getId() : null;
  9.         return $this;
  10.     }
  11.  
  12.  
  13.     public function getIdentity() {
  14.         if(!$session = $this->getSessionSection(FALSE)) return NULL;
  15.         if(!$id = $session->identityId) return NULL;
  16.  
  17.         // nactu z doctrine
  18.         return $this->em->getRepository(IdentityEntity::getClassName())->find($id);
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment