src/User/Service/User.php
public function getEntity($idOrUser) 
    {
		// All the services we need
		$main = $this->getServiceLocator()->get('neobazaar.service.main');
		$userRepository = $main->getUserEntityRepository();
		
    	if(!$idOrUser instanceof UserEntity) {
    		if(is_numeric($idOrUser)) {
    			$user = $userRepository->find($idOrUser);
    		} else {
    			$user = $userRepository->findByEncryptedId($idOrUser, 'userId');
    		}
    	} else {
    		$user = $idOrUser;
    	}
		
		if(!$user instanceof UserEntity) {
			throw new \Exception('Errore di sistema, riprovare più tardi');
		}
    	
    	return $user;
    }
public function getEntity($idOrUser) 
    {
		// All the services we need
		$main = $this->getServiceLocator()->get('neobazaar.service.main');
		$userRepository = $main->getUserEntityRepository();
		
    	if(!$idOrUser instanceof UserEntity) {
    		if(is_numeric($idOrUser)) {
    			$user = $userRepository->find($idOrUser);
    		} else {
    			$user = $userRepository->findByEncryptedId($idOrUser, 'userId');
    		}
    	} else {
    		$user = $idOrUser;
    	}
		
		if(!$user instanceof UserEntity) {
			throw new \Exception('Errore di sistema, riprovare più tardi');
		}
    	
    	return $user;
    }
Return the user entity

@param unknown $idOrDocument
@throws \Exception
@return \Neobazaar\Entity\User