From c48a437a4fc9cb3ed68fdacb34e6056012dff80b Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 30 May 2023 03:42:51 +0200 Subject: [PATCH 1/3] use direct data access for response data --- Controller/ApiController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 64aea2c..d573ba3 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -61,7 +61,7 @@ final class ApiController extends Controller ->where('id', $request->getDataInt('item')) ->execute(); - $itemFiles = $item->getFiles(); + $itemFiles = $item->files; foreach ($itemFiles as $file) { if ($file->id === $request->getDataInt('id') && ($file->hasMediaTypeName('item_demo_download') @@ -104,7 +104,7 @@ final class ApiController extends Controller } foreach ($items as $item) { - $files = $item->getFiles(); + $files = $item->files; foreach ($files as $file) { if ($file->id === $request->getDataInt('id') From a304002712c9cb3fdbfd1e6046e1131a50626e72 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 30 May 2023 04:15:41 +0200 Subject: [PATCH 2/3] continue with getter/setter removal --- .../Install/Application/Shop/Application.php | 24 +++++++++---------- Admin/Install/Application/Shop/index.tpl.php | 2 +- Controller/ApiController.php | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Admin/Install/Application/Shop/Application.php b/Admin/Install/Application/Shop/Application.php index 8252002..1df3092 100755 --- a/Admin/Install/Application/Shop/Application.php +++ b/Admin/Install/Application/Shop/Application.php @@ -154,7 +154,7 @@ final class Application if ($account->id > 0) { $response->header->l11n = $account->l11n; } elseif ($this->app->sessionManager->get('language') !== null - && $response->header->l11n->getLanguage() !== $this->app->sessionManager->get('language') + && $response->header->l11n->language !== $this->app->sessionManager->get('language') ) { $response->header->l11n ->loadFromLanguage( @@ -165,7 +165,7 @@ final class Application $this->app->setResponseLanguage($request, $response, $this->config); } - if (!\in_array($response->getLanguage(), $this->config['language'])) { + if (!\in_array($response->header->l11n->language, $this->config['language'])) { $response->header->l11n->setLanguage($this->app->l11nServer->getLanguage()); } @@ -190,14 +190,14 @@ final class Application return; } - UriFactory::setQuery('/lang', $response->getLanguage()); + UriFactory::setQuery('/lang', $response->header->l11n->language); $this->loadLanguageFromPath( - $response->getLanguage(), - __DIR__ . '/lang/' . $response->getLanguage() . '.lang.php' + $response->header->l11n->language, + __DIR__ . '/lang/' . $response->header->l11n->language . '.lang.php' ); - $response->header->set('content-language', $response->getLanguage(), true); + $response->header->set('content-language', $response->header->l11n->language, true); /* Create html head */ $this->initResponseHead($head, $request, $response); @@ -255,8 +255,8 @@ final class Application $response->header->status = RequestStatusCode::R_406; $pageView->setTemplate('/Web/{APPNAME}/Error/406'); $this->loadLanguageFromPath( - $response->getLanguage(), - __DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php' + $response->header->l11n->language, + __DIR__ . '/Error/lang/' . $response->header->l11n->language . '.lang.php' ); } @@ -275,8 +275,8 @@ final class Application $response->header->status = RequestStatusCode::R_503; $pageView->setTemplate('/Web/{APPNAME}/Error/503'); $this->loadLanguageFromPath( - $response->getLanguage(), - __DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php' + $response->header->l11n->language, + __DIR__ . '/Error/lang/' . $response->header->l11n->language . '.lang.php' ); } @@ -334,8 +334,8 @@ final class Application $response->header->status = RequestStatusCode::R_403; $pageView->setTemplate('/Web/{APPNAME}/Error/403'); $this->loadLanguageFromPath( - $response->getLanguage(), - __DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php' + $response->header->l11n->language, + __DIR__ . '/Error/lang/' . $response->header->l11n->language . '.lang.php' ); } diff --git a/Admin/Install/Application/Shop/index.tpl.php b/Admin/Install/Application/Shop/index.tpl.php index 6e064d3..fd9d804 100755 --- a/Admin/Install/Application/Shop/index.tpl.php +++ b/Admin/Install/Application/Shop/index.tpl.php @@ -22,7 +22,7 @@ $head = $this->getData('head'); $dispatch = $this->getData('dispatch') ?? []; ?> - + diff --git a/Controller/ApiController.php b/Controller/ApiController.php index d573ba3..c8d4511 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -236,7 +236,7 @@ final class ApiController extends Controller ->with('attributes/value') ->with('l11n/type') ->where('l11n/type/title', ['name1', 'name2', 'name3'], 'IN') - ->where('l11n/language', $bill->getLanguage()); + ->where('l11n/language', $bill->language); /** @var \Modules\ItemManagement\Models\Item $item */ $item = $itemMapper->execute(); From a4d7d58ba92d9efca827516f46983672a5eeeb81 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 30 May 2023 15:44:24 +0200 Subject: [PATCH 3/3] Continue with getter/setter cleanup --- Admin/Install/Application/Shop/Application.php | 2 +- Admin/Install/Application/Shop/index.tpl.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Admin/Install/Application/Shop/Application.php b/Admin/Install/Application/Shop/Application.php index 1df3092..65dc327 100755 --- a/Admin/Install/Application/Shop/Application.php +++ b/Admin/Install/Application/Shop/Application.php @@ -173,7 +173,7 @@ final class Application $head = new Head(); $pageView->setData('unitId', $this->app->unitId); - $pageView->setData('head', $head); + $pageView->data['head'] = $head; $response->set('Content', $pageView); /* App only allows GET */ diff --git a/Admin/Install/Application/Shop/index.tpl.php b/Admin/Install/Application/Shop/index.tpl.php index fd9d804..ffc3891 100755 --- a/Admin/Install/Application/Shop/index.tpl.php +++ b/Admin/Install/Application/Shop/index.tpl.php @@ -16,7 +16,7 @@ declare(strict_types=1); use phpOMS\Uri\UriFactory; /** @var phpOMS\Model\Html\Head $head */ -$head = $this->getData('head'); +$head = $this->head; /** @var array $dispatch */ $dispatch = $this->getData('dispatch') ?? [];