Continue with getter/setter cleanup

This commit is contained in:
Dennis Eichhorn 2023-05-30 15:44:26 +02:00
parent 4ba0cf0d59
commit ae00a17cbc
5 changed files with 26 additions and 38 deletions

View File

@ -49,29 +49,23 @@ final class BackendController extends Controller
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response);
if ($request->getData('ptype') === 'p') {
$view->setData('stocks',
StockMapper::getAll()
$view->data['stocks'] = StockMapper::getAll()
->where('id', $request->getDataInt('id') ?? 0)
->limit(25)
->execute()
);
->execute();
} elseif ($request->getData('ptype') === 'n') {
$view->setData('stocks',
StockMapper::getAll()
$view->data['stocks'] = StockMapper::getAll()
->where('id', $request->getDataInt('id') ?? 0)
->limit(25)
->execute()
);
->execute();
} else {
$view->setData('stocks',
StockMapper::getAll()
$view->data['stocks'] = StockMapper::getAll()
->where('id', 0)
->limit(25)
->execute()
);
->execute();
}
return $view;
@ -94,9 +88,9 @@ final class BackendController extends Controller
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response);
$view->setData('stock', StockMapper::get()->where('id', (int) $request->getData('id'))->execute());
$view->data['stock'] = StockMapper::get()->where('id', (int) $request->getData('id'))->execute();
return $view;
}
@ -118,29 +112,23 @@ final class BackendController extends Controller
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-location-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response);
if ($request->getData('ptype') === 'p') {
$view->setData('locations',
StockLocationMapper::getAll()
$view->data['locations'] = StockLocationMapper::getAll()
->where('id', $request->getDataInt('id') ?? 0)
->limit(25)
->execute()
);
->execute();
} elseif ($request->getData('ptype') === 'n') {
$view->setData('locations',
StockLocationMapper::getAll()
$view->data['locations'] = StockLocationMapper::getAll()
->where('id', $request->getDataInt('id') ?? 0)
->limit(25)
->execute()
);
->execute();
} else {
$view->setData('locations',
StockLocationMapper::getAll()
$view->data['locations'] = StockLocationMapper::getAll()
->where('id', 0)
->limit(25)
->execute()
);
->execute();
}
return $view;
@ -163,9 +151,9 @@ final class BackendController extends Controller
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-location');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response);
$view->setData('location', StockLocationMapper::get()->where('id', (int) $request->getData('id'))->execute());
$view->data['location'] = StockLocationMapper::get()->where('id', (int) $request->getData('id'))->execute();
return $view;
}

View File

@ -14,9 +14,9 @@ declare(strict_types=1);
use phpOMS\Uri\UriFactory;
$stocks = $this->getData('stocks') ?? [];
$stocks = $this->data['stocks'] ?? [];
echo $this->getData('nav')->render(); ?>
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">

View File

@ -14,9 +14,9 @@ declare(strict_types=1);
use phpOMS\Uri\UriFactory;
$locations = $this->getData('locations') ?? [];
$locations = $this->data['locations'] ?? [];
echo $this->getData('nav')->render(); ?>
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">

View File

@ -12,9 +12,9 @@
*/
declare(strict_types=1);
$location = $this->getData('location');
$location = $this->data['location'];
echo $this->getData('nav')->render();
echo $this->data['nav']->render();
?>
<div class="row">
<div class="col-xs-12">

View File

@ -12,9 +12,9 @@
*/
declare(strict_types=1);
$stock = $this->getData('stock');
$stock = $this->data['stock'];
echo $this->getData('nav')->render();
echo $this->data['nav']->render();
?>
<div class="row">
<div class="col-xs-12">