draft ::with() function for models

This commit is contained in:
Dennis Eichhorn 2021-03-11 21:23:41 +01:00
parent cbfe2cec76
commit 1d0bdd39e9

View File

@ -74,17 +74,17 @@ final class BackendController extends Controller
if ($request->getData('ptype') === 'p') {
$view->setData('tags',
TagMapper::withConditional('language', $response->getLanguage())
TagMapper::with('language', $response->getLanguage())
::getBeforePivot((int) ($request->getData('id') ?? 0), null, 25)
);
} elseif ($request->getData('ptype') === 'n') {
$view->setData('tags',
TagMapper::withConditional('language', $response->getLanguage())
TagMapper::with('language', $response->getLanguage())
::getAfterPivot((int) ($request->getData('id') ?? 0), null, 25)
);
} else {
$view->setData('tags',
TagMapper::withConditional('language', $response->getLanguage())
TagMapper::with('language', $response->getLanguage())
::getAfterPivot(0, null, 25)
);
}
@ -107,13 +107,13 @@ final class BackendController extends Controller
public function viewTagSingle(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$tag = TagMapper::withConditional('language', $response->getLanguage())::get((int) $request->getData('id'));
$tag = TagMapper::with('language', $response->getLanguage())::get((int) $request->getData('id'));
$view->setTemplate('/Modules/Tag/Theme/Backend/tag-single');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1007501001, $request, $response));
$view->addData('tag', $tag);
$l11n = TagL11nMapper::withConditional('tag', $tag->getId())::getAll();
$l11n = TagL11nMapper::with('tag', $tag->getId())::getAll();
$view->addData('l11n', $l11n);
return $view;