A `Some` value with the user information if found, `None` otherwise * @throws DocumentException If any is encountered */ public static function findByEmail(string $email): Option { return Find::firstByFields(Table::USER, [Field::EQ('email', $email)], User::class); } /** * Add a user * * @param string $email The e-mail address for the user * @param string $password The user's password * @throws DocumentException If any is encountered */ public static function add(string $email, string $password): void { Document::insert(Table::USER, new User(email: $email, password: $password)); } /** * Does this user have any bookmarked items? * * @return bool True if the user has any bookmarked items, false if not * @throws DocumentException If any is encountered */ public static function hasBookmarks(): bool { $fields = [Data::userIdField(Table::FEED), Data::bookmarkField(true, Table::ITEM)]; return Custom::scalar(Query\Exists::query(ItemWithFeed::FROM_WITH_JOIN, Query::whereByFields($fields)), Parameters::addFields($fields, []), new ExistsMapper()); } }