public function GetUniqueKey($uniqueKey) { try { $db = $this->connection(); $sql = "SELECT * FROM " . self::$dbTable . " WHERE " . self::$uniqueKey . " = ?"; $params = array($uniqueKey); $query = $db->prepare($sql); $query->execute($params); $result = $query->fetch(); if ($result) { $user = new User(); // Set my UserID and Expire to my dbUserModel. $user->SetUserID($result[self::$userID]); $user->SetExpire($result[self::$expire]); return $user; } else { return NULL; } } catch (\PDOException $e) { throw new \Exception(); } }