From b1457fe4caa93a8475a337acec79d6d42d66adfc Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 30 May 2023 04:15:38 +0200 Subject: [PATCH] continue with getter/setter removal --- Controller/ApiController.php | 2 +- Controller/BackendController.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Controller/ApiController.php b/Controller/ApiController.php index afba589..3194406 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -328,7 +328,7 @@ final class ApiController extends Controller $newsArticle->title = $request->getDataString('title') ?? ''; $newsArticle->plain = $request->getDataString('plain') ?? ''; $newsArticle->content = Markdown::parse($request->getDataString('plain') ?? ''); - $newsArticle->setLanguage(\strtolower($request->getDataString('lang') ?? $request->getLanguage())); + $newsArticle->setLanguage(\strtolower($request->getDataString('lang') ?? $request->header->l11n->language)); $newsArticle->setType($request->getDataInt('type') ?? NewsType::ARTICLE); $newsArticle->setStatus($request->getDataInt('status') ?? NewsStatus::VISIBLE); $newsArticle->isFeatured = $request->getDataBool('featured') ?? true; diff --git a/Controller/BackendController.php b/Controller/BackendController.php index c5b0318..0a4b59c 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -62,8 +62,8 @@ final class BackendController extends Controller implements DashboardElementInte ->with('tags/title') ->where('status', NewsStatus::VISIBLE) ->where('publish', new \DateTime('now'), '<=') - ->where('language', $response->getLanguage()) - ->where('tags/title/language', $response->getLanguage()); + ->where('language', $response->header->l11n->language) + ->where('tags/title/language', $response->header->l11n->language); /** @var \Modules\News\Models\NewsArticle[] $objs */ $objs = []; @@ -124,8 +124,8 @@ final class BackendController extends Controller implements DashboardElementInte ->with('tags/title') ->where('status', NewsStatus::VISIBLE) ->where('publish', new \DateTime('now'), '<=') - ->where('language', $response->getLanguage()) - ->where('tags/title/language', $response->getLanguage()) + ->where('language', $response->header->l11n->language) + ->where('tags/title/language', $response->header->l11n->language) ->where('id', 0, '>') ->limit(5) ->execute(); @@ -163,8 +163,8 @@ final class BackendController extends Controller implements DashboardElementInte ->with('tags/title') ->where('status', NewsStatus::VISIBLE) ->where('publish', new \DateTime('now'), '<=') - ->where('language', $response->getLanguage()) - ->where('tags/title/language', $response->getLanguage()) + ->where('language', $response->header->l11n->language) + ->where('tags/title/language', $response->header->l11n->language) ->where('id', (int) $request->getData('id')) ->execute(); @@ -240,8 +240,8 @@ final class BackendController extends Controller implements DashboardElementInte ->with('tags/title') ->where('status', NewsStatus::VISIBLE) ->where('publish', new \DateTime('now'), '<=') - ->where('language', $response->getLanguage()) - ->where('tags/title/language', $response->getLanguage()); + ->where('language', $response->header->l11n->language) + ->where('tags/title/language', $response->header->l11n->language); if ($request->getData('ptype') === 'p') { $view->setData('news',