beta4 changes #26
5
src/composer.lock
generated
5
src/composer.lock
generated
|
@ -12,12 +12,13 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.bitbadger.solutions/bit-badger/inspired-by-fsharp",
|
"url": "https://git.bitbadger.solutions/bit-badger/inspired-by-fsharp",
|
||||||
"reference": "193147cfb32f423dceb1619f091445efa1a2f13e"
|
"reference": "7d25b9ea282c1e244fec6e14a1e1b251314824e4"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8"
|
"php": "^8"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"phpoption/phpoption": "^1",
|
||||||
"phpunit/phpunit": "^11"
|
"phpunit/phpunit": "^11"
|
||||||
},
|
},
|
||||||
"default-branch": true,
|
"default-branch": true,
|
||||||
|
@ -49,7 +50,7 @@
|
||||||
"rss": "https://git.bitbadger.solutions/bit-badger/inspired-by-fsharp.rss",
|
"rss": "https://git.bitbadger.solutions/bit-badger/inspired-by-fsharp.rss",
|
||||||
"source": "https://git.bitbadger.solutions/bit-badger/inspired-by-fsharp"
|
"source": "https://git.bitbadger.solutions/bit-badger/inspired-by-fsharp"
|
||||||
},
|
},
|
||||||
"time": "2024-07-27T02:55:02+00:00"
|
"time": "2024-07-28T01:20:35+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "bit-badger/pdo-document",
|
"name": "bit-badger/pdo-document",
|
||||||
|
|
|
@ -299,7 +299,7 @@ class Feed
|
||||||
*/
|
*/
|
||||||
public static function retrieveById(int $feedId): Option
|
public static function retrieveById(int $feedId): Option
|
||||||
{
|
{
|
||||||
return to_option(
|
return Option::of(
|
||||||
Find::byId(Table::Feed, $feedId, static::class)
|
Find::byId(Table::Feed, $feedId, static::class)
|
||||||
->filter(fn($it) => $it->user_id === $_SESSION[Key::UserId]));
|
->filter(fn($it) => $it->user_id === $_SESSION[Key::UserId]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ class ItemWithFeed extends Item
|
||||||
public static function retrieveById(int $id): Option
|
public static function retrieveById(int $id): Option
|
||||||
{
|
{
|
||||||
$fields = self::idAndUserFields($id);
|
$fields = self::idAndUserFields($id);
|
||||||
return to_option(
|
return Option::of(
|
||||||
Custom::single(self::SELECT_WITH_FEED . ' WHERE ' . Query::whereByFields($fields),
|
Custom::single(self::SELECT_WITH_FEED . ' WHERE ' . Query::whereByFields($fields),
|
||||||
Parameters::addFields($fields, []), new DocumentMapper(self::class)));
|
Parameters::addFields($fields, []), new DocumentMapper(self::class)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class User
|
||||||
*/
|
*/
|
||||||
public static function findByEmail(string $email): Option
|
public static function findByEmail(string $email): Option
|
||||||
{
|
{
|
||||||
return to_option(Find::firstByFields(Table::User, [Field::EQ('email', $email)], User::class));
|
return Option::of(Find::firstByFields(Table::User, [Field::EQ('email', $email)], User::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -187,14 +187,3 @@ function not_found(): never
|
||||||
http_response_code(404);
|
http_response_code(404);
|
||||||
die('Not Found');
|
die('Not Found');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Transform a `PhpOption` into the option we use
|
|
||||||
*
|
|
||||||
* @param \PhpOption\Option $option The option to be transformed
|
|
||||||
* @return Option An option in the form Feed Reader Central uses
|
|
||||||
*/
|
|
||||||
function to_option(PhpOption\Option $option): Option
|
|
||||||
{
|
|
||||||
return $option->isDefined() ? Option::Some($option->get()) : Option::None();
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user