WIP with option and result types

This commit is contained in:
2024-06-25 18:37:00 -04:00
parent dfd9a873f8
commit 1d5a3c1c7a
16 changed files with 302 additions and 136 deletions

View File

@@ -4,6 +4,7 @@ namespace FeedReaderCentral;
use BitBadger\PDODocument\{Custom, Document, DocumentException, Field, Find, Parameters, Query};
use BitBadger\PDODocument\Mapper\ExistsMapper;
use PhpOption\Option;
/**
* A user of Feed Reader Central
@@ -23,10 +24,10 @@ class User
* Find a user by their e=mail address
*
* @param string $email The e-mail address of the user to retrieve
* @return User|false The user information, or null if the user is not found
* @return Option<User> A `Some` value with the user information if found, `None` otherwise
* @throws DocumentException If any is encountered
*/
public static function findByEmail(string $email): User|false
public static function findByEmail(string $email): Option
{
return Find::firstByFields(Table::USER, [Field::EQ('email', $email)], User::class);
}