Continue with getter/setter cleanup

This commit is contained in:
Dennis Eichhorn 2023-05-30 15:44:25 +02:00
parent ee84056dd9
commit 3e56107c9b
4 changed files with 17 additions and 23 deletions

View File

@ -49,7 +49,7 @@ final class BackendController extends Controller
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Tag/Theme/Backend/tag-create');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1007501001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007501001, $request, $response);
return $view;
}
@ -71,35 +71,29 @@ final class BackendController extends Controller
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Tag/Theme/Backend/tag-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1007501001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007501001, $request, $response);
if ($request->getData('ptype') === 'p') {
$view->setData('tags',
TagMapper::getAll()
$view->data['tags'] = TagMapper::getAll()
->with('title')
->where('id', $request->getDataInt('id') ?? 0, '<')
->where('title/language', $request->header->l11n->language)
->limit(25)
->execute()
);
->execute();
} elseif ($request->getData('ptype') === 'n') {
$view->setData('tags',
TagMapper::getAll()
$view->data['tags'] = TagMapper::getAll()
->with('title')
->where('id', $request->getDataInt('id') ?? 0, '>')
->where('title/language', $request->header->l11n->language)
->limit(25)
->execute()
);
->execute();
} else {
$view->setData('tags',
TagMapper::getAll()
$view->data['tags'] = TagMapper::getAll()
->with('title')
->where('id', 0, '>')
->where('title/language', $request->header->l11n->language)
->limit(25)
->execute()
);
->execute();
}
return $view;
@ -129,15 +123,15 @@ final class BackendController extends Controller
->execute();
$view->setTemplate('/Modules/Tag/Theme/Backend/tag-single');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1007501001, $request, $response));
$view->addData('tag', $tag);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007501001, $request, $response);
$view->data['tag'] = $tag;
/** @var \phpOMS\Localization\BaseStringL11n[] $l11n */
$l11n = TagL11nMapper::getAll()
->where('ref', $tag->id)
->execute();
$view->addData('l11n', $l11n);
$view->data['l11n'] = $l11n;
return $view;
}

View File

@ -15,7 +15,7 @@ declare(strict_types=1);
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Views\View $this */
echo $this->getData('nav')->render(); ?>
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="portlet">

View File

@ -18,12 +18,12 @@ use phpOMS\Uri\UriFactory;
* @var \phpOMS\Views\View $this
* @var \Modules\Tag\Models\Tag[] $tags
*/
$tags = $this->getData('tags');
$tags = $this->data['tags'];
$previous = empty($tags) ? '{/base}/tag/list' : '{/base}/tag/list?{?}&id=' . \reset($tags)->id . '&ptype=p';
$next = empty($tags) ? '{/base}/tag/list' : '{/base}/tag/list?{?}&id=' . \end($tags)->id . '&ptype=n';
echo $this->getData('nav')->render(); ?>
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">
<div class="portlet">

View File

@ -16,11 +16,11 @@ use phpOMS\Localization\ISO639Enum;
use phpOMS\Uri\UriFactory;
/** @var \Modules\Tag\Models\Tag */
$tag = $this->getData('tag');
$l11n = $this->getData('l11n') ?? [];
$tag = $this->data['tag'];
$l11n = $this->data['l11n'] ?? [];
/** @var \phpOMS\Views\View $this */
echo $this->getData('nav')->render(); ?>
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="portlet">