Update to beta2 of doc lib
This commit is contained in:
@@ -8,8 +8,7 @@ use DateTimeImmutable;
|
||||
use Exception;
|
||||
use JsonSerializable;
|
||||
use MyPrayerJournal\Table;
|
||||
use PhpOption\{None, Option, Some};
|
||||
use Visus\Cuid2\Cuid2;
|
||||
use PhpOption\{None, Option};
|
||||
|
||||
/**
|
||||
* A prayer request
|
||||
@@ -30,12 +29,7 @@ class Request implements JsonSerializable
|
||||
public function __construct(public string $id = '', public string $enteredOn = '', public string $userId = '',
|
||||
public ?string $snoozedUntil = null, public ?string $showAfter = null,
|
||||
public Recurrence $recurrence = new Recurrence(RecurrencePeriod::Immediate),
|
||||
public array $history = [], public array $notes = [])
|
||||
{
|
||||
if ($id == '') {
|
||||
$this->id = (new Cuid2())->toString();
|
||||
}
|
||||
}
|
||||
public array $history = [], public array $notes = []) { }
|
||||
|
||||
/**
|
||||
* Get the current text for this request
|
||||
@@ -118,7 +112,7 @@ class Request implements JsonSerializable
|
||||
public static function byId(string $id): Option
|
||||
{
|
||||
$req = Find::byId(Table::REQUEST, $id, self::class);
|
||||
return ($req && $req->userId == $_SESSION['user_id']) ? Some::create($req) : None::create();
|
||||
return ($req->getOrElse(new Request('x'))->userId == $_SESSION['user_id']) ? $req : None::create();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user