Exemplo n.º 1
0
 /**
  * Get a specific entity or generate a new one if id is empty
  *
  * @param $id
  *
  * @return null|Email
  */
 public function getEntity($id = null)
 {
     if ($id === null) {
         $entity = new Email();
         $entity->setSessionId('new_' . hash('sha1', uniqid(mt_rand())));
     } else {
         $entity = parent::getEntity($id);
         if ($entity !== null) {
             $entity->setSessionId($entity->getId());
         }
     }
     return $entity;
 }
 /**
  * {@inheritDoc}
  */
 public function setSessionId($sessionId)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setSessionId', array($sessionId));
     return parent::setSessionId($sessionId);
 }