diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 9cf4850..d892075 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -224,8 +224,17 @@ final class ApiController extends Controller return; } - /** @var Profile $profile */ - $profile = (int) ($request->getData('profile') ?? ProfileMapper::get()->where('account', $request->getData('account'))->execute()->getId()); + $profile = 0; + if ($request->hasData('profile')) { + $profile = (int) ($request->getData('profile') ?? 0); + } else { + /** @var \Modules\Profile\Models\Profile $profileObj */ + $profileObj = ProfileMapper::get() + ->where('account', (int) ($request->getData('account') ?? 0)) + ->execute(); + + $profile = $profileObj->getId(); + } $contactElement = $this->createContactElementFromRequest($request); @@ -298,8 +307,17 @@ final class ApiController extends Controller return; } - /** @var Profile $profile */ - $profile = (int) ($request->getData('profile') ?? ProfileMapper::get()->where('account', $request->getData('account'))->execute()->getId()); + $profile = 0; + if ($request->hasData('profile')) { + $profile = (int) ($request->getData('profile') ?? 0); + } else { + /** @var \Modules\Profile\Models\Profile $profileObj */ + $profileObj = ProfileMapper::get() + ->where('account', (int) ($request->getData('account') ?? 0)) + ->execute(); + + $profile = $profileObj->getId(); + } $address = $this->createAddressFromRequest($request); diff --git a/Controller/BackendController.php b/Controller/BackendController.php index d1c9e8f..ec0b33e 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -97,6 +97,7 @@ final class BackendController extends Controller ); } + /** @var \Model\Setting $profileImage */ $profileImage = $this->app->appSettings->get(names: SettingsEnum::DEFAULT_PROFILE_IMAGE, module: 'Profile'); /** @var \Modules\Media\Models\Media $image */ @@ -172,8 +173,11 @@ final class BackendController extends Controller $view->setData('media', $media); + /** @var \Model\Setting $profileImage */ $profileImage = $this->app->appSettings->get(names: SettingsEnum::DEFAULT_PROFILE_IMAGE, module: 'Profile'); - $image = MediaMapper::get()->where('id', (int) $profileImage->content)->execute(); + + /** @var \Modules\Media\Models\Media $image */ + $image = MediaMapper::get()->where('id', (int) $profileImage->content)->execute(); $view->setData('defaultImage', $image); diff --git a/Theme/Backend/Components/AccountGroupSelector/BaseView.php b/Theme/Backend/Components/AccountGroupSelector/BaseView.php index c8327e0..8dde5e2 100755 --- a/Theme/Backend/Components/AccountGroupSelector/BaseView.php +++ b/Theme/Backend/Components/AccountGroupSelector/BaseView.php @@ -95,10 +95,13 @@ class BaseView extends View */ public function render(mixed ...$data) : string { + /** @var array{0:string, 1:string, 2:null|bool} $data */ $this->id = $data[0]; $this->name = $data[1]; $this->isRequired = $data[2] ?? false; + $this->getData('popup')->setId($this->id); + return parent::render(); } } diff --git a/Theme/Backend/Components/AccountGroupSelector/PopupView.php b/Theme/Backend/Components/AccountGroupSelector/PopupView.php index c8b78a4..f749d57 100755 --- a/Theme/Backend/Components/AccountGroupSelector/PopupView.php +++ b/Theme/Backend/Components/AccountGroupSelector/PopupView.php @@ -78,6 +78,7 @@ class PopupView extends View */ public function render(mixed ...$data) : string { + /** @var array{0: null|string} $data */ $this->id = $data[0] ?? $this->id; return parent::render(); }