Esempio n. 1
0
 /**
  * @param string    $userId
  * @param string    $authBackend
  * @param \DateTime $lastLogin
  *
  * @return \Cms\Data\UserStatus
  * @throws CmsException
  */
 public function setLastLogin($userId, $authBackend, \DateTime $lastLogin)
 {
     $orm = $this->getOrmByUserIdAndAuthBackend($userId, $authBackend, false);
     if (is_null($orm)) {
         $orm = new OrmUserStatus();
         $orm->setUserId($userId);
         $orm->setAuthbackend($authBackend);
     }
     try {
         $orm->setLastlogin($lastLogin);
         $entityManager = $this->getEntityManager();
         $entityManager->persist($orm);
         $entityManager->flush();
         $entityManager->refresh($orm);
         $this->clearEntityManager();
     } catch (\Exception $e) {
         throw new CmsException(2811, __METHOD__, __LINE__, null, $e);
     }
     return $orm->toCmsData();
 }
 /**
  * {@inheritDoc}
  */
 public function setUserId($userid)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setUserId', array($userid));
     return parent::setUserId($userid);
 }