WIP with option and result types
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user