protected function _mapMongoModelToModel(array $model) { $result = parent::_mapMongoModelToModel($model); $result['id'] = $model['configId']; unset($result['configId']); return $result; }
/** * * @param type $userId * @return type * @throws InvalidArgumentException * @throws MongoException */ public function getLastUsedPasswords($userId) { if (!$userId) { throw new InvalidArgumentException(get_class($this) . ": userId param not given <<"); } try { $collection = new \MongoCollection(\App::getMongoDB(), 'user_password'); $result = $collection->findOne(array('_id' => $userId)); $result = $result ? parent::_mapMongoModelToModel($result) : array(); } catch (\Exception $e) { throw new MongoException($e->getMessage()); } return isset($result['passwords']) ? $result['passwords'] : array(); }