From a96612d723b37198f19fc68294052ea4ec88f3c6 Mon Sep 17 00:00:00 2001 From: ArrayIterator Date: Mon, 11 Mar 2024 16:12:30 +0700 Subject: [PATCH] add patch --- Depends/Option.php | 13 +++++++++---- Entities/Site.php | 2 -- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Depends/Option.php b/Depends/Option.php index cabe523..e1f72a0 100644 --- a/Depends/Option.php +++ b/Depends/Option.php @@ -30,7 +30,7 @@ public function determineSite($site, &$argumentValid = null) : ?Site if ($site instanceof Site) { $argumentValid = true; if ($site->isPostLoad()) { - return $site; + return $site?:null; } $site = $site->getId(); if (!is_int($site)) { @@ -101,10 +101,15 @@ public function getBatch( ); } + /** + * @param Site|int|null $site + * @return int|null + */ private function normalizeSiteId(Site|int|null $site = null) : ?int { $site ??= $this->users->getSite(); - return !$site ? null : (is_int($site) ? $site : $site->getId()); + $site = $site instanceof Site ? $site->getId() : $site; + return is_int($site) ? $site : null; } public function getOrCreate( @@ -112,6 +117,7 @@ public function getOrCreate( &$siteObject = null, Site|false|null $site = false ): ?Options { + $site = $site?:null; $option = $this->get($name, $site, $siteObject); if (!$option) { $option = new Options(); @@ -135,8 +141,7 @@ public function saveBatch( /** * @param string $name - * @param null $siteId - * @param ?Sites $site + * @param Site|null $site * @return Options|null */ public function get( diff --git a/Entities/Site.php b/Entities/Site.php index 466c671..1c4a96d 100644 --- a/Entities/Site.php +++ b/Entities/Site.php @@ -366,8 +366,6 @@ final public function isPostLoad(): bool #[PostLoad] final public function finalPostLoaded(PostLoadEventArgs $postLoadEventArgs): void { - print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)); - exit; $this->postLoad = true; } }