diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 2e3123a..d26787c 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -123,7 +123,7 @@ final class ApiController extends Controller } $tag = $this->createTagFromRequest($request); - $tag->setL11n($request->getDataString('title') ?? '', $request->getDataString('language') ?? $request->getLanguage()); + $tag->setL11n($request->getDataString('title') ?? '', $request->getDataString('language') ?? $request->header->l11n->language); $this->createModel($request->header->account, $tag, TagMapper::class, 'tag', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Tag', 'Tag successfully created', $tag); @@ -210,7 +210,7 @@ final class ApiController extends Controller $tagL11n = new BaseStringL11n(); $tagL11n->ref = $request->getDataInt('tag') ?? 0; $tagL11n->setLanguage( - $request->getDataString('language') ?? $request->getLanguage() + $request->getDataString('language') ?? $request->header->l11n->language ); $tagL11n->content = $request->getDataString('title') ?? ''; @@ -276,7 +276,7 @@ final class ApiController extends Controller /** @var \Modules\Tag\Models\Tag[] $tags */ $tags = TagMapper::getAll() ->with('title') - ->where('title/language', $request->getLanguage()) + ->where('title/language', $request->header->l11n->language) ->where('title/content', '%' . ($request->getDataString('search') ?? '') . '%', 'LIKE') ->execute(); diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 31cbf59..f842fac 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -78,7 +78,7 @@ final class BackendController extends Controller TagMapper::getAll() ->with('title') ->where('id', $request->getDataInt('id') ?? 0, '<') - ->where('title/language', $request->getLanguage()) + ->where('title/language', $request->header->l11n->language) ->limit(25) ->execute() ); @@ -87,7 +87,7 @@ final class BackendController extends Controller TagMapper::getAll() ->with('title') ->where('id', $request->getDataInt('id') ?? 0, '>') - ->where('title/language', $request->getLanguage()) + ->where('title/language', $request->header->l11n->language) ->limit(25) ->execute() ); @@ -96,7 +96,7 @@ final class BackendController extends Controller TagMapper::getAll() ->with('title') ->where('id', 0, '>') - ->where('title/language', $request->getLanguage()) + ->where('title/language', $request->header->l11n->language) ->limit(25) ->execute() ); @@ -125,7 +125,7 @@ final class BackendController extends Controller $tag = TagMapper::get() ->with('title') ->where('id', (int) $request->getData('id')) - ->where('title/language', $response->getLanguage()) + ->where('title/language', $response->header->l11n->language) ->execute(); $view->setTemplate('/Modules/Tag/Theme/Backend/tag-single'); diff --git a/tests/Models/TagL11nMapperTest.php b/tests/Models/TagL11nMapperTest.php index fed452d..ce6a62b 100755 --- a/tests/Models/TagL11nMapperTest.php +++ b/tests/Models/TagL11nMapperTest.php @@ -51,6 +51,6 @@ final class TagL11nMapperTest extends \PHPUnit\Framework\TestCase $l11nR = TagL11nMapper::get()->where('id', $l11n->id)->execute(); self::assertEquals($l11n->content, $l11nR->content); - self::assertEquals($l11n->getLanguage(), $l11nR->getLanguage()); + self::assertEquals($l11n->language, $l11nR->getLanguage()); } }