Continue with getter/setter cleanup

This commit is contained in:
Dennis Eichhorn 2023-05-30 15:44:25 +02:00
parent 61f4906a8b
commit 5814586d04
6 changed files with 30 additions and 30 deletions

View File

@ -55,7 +55,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/SupplierManagement/Theme/Backend/attribute-type-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response);
/** @var \Modules\Attribute\Models\AttributeType[] $attributes */
$attributes = SupplierAttributeTypeMapper::getAll()
@ -63,7 +63,7 @@ final class BackendController extends Controller
->where('l11n/language', $response->header->l11n->language)
->execute();
$view->addData('attributes', $attributes);
$view->data['attributes'] = $attributes;
return $view;
}
@ -84,7 +84,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/SupplierManagement/Theme/Backend/attribute-value-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response);
/** @var \Modules\Attribute\Models\AttributeValue[] $attributes */
$attributes = SupplierAttributeValueMapper::getAll()
@ -92,7 +92,7 @@ final class BackendController extends Controller
->where('l11n/language', $response->header->l11n->language)
->execute();
$view->addData('attributes', $attributes);
$view->data['attributes'] = $attributes;
return $view;
}
@ -113,7 +113,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/SupplierManagement/Theme/Backend/attribute-type');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response);
/** @var \Modules\Attribute\Models\AttributeType $attribute */
$attribute = SupplierAttributeTypeMapper::get()
@ -126,8 +126,8 @@ final class BackendController extends Controller
->where('ref', $attribute->id)
->execute();
$view->addData('attribute', $attribute);
$view->addData('l11ns', $l11ns);
$view->data['attribute'] = $attribute;
$view->data['l11ns'] = $l11ns;
return $view;
}
@ -148,7 +148,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/SupplierManagement/Theme/Backend/supplier-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1003202001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003202001, $request, $response);
$supplier = SupplierMapper::getAll()
->with('account')
@ -156,7 +156,7 @@ final class BackendController extends Controller
->limit(25)
->execute();
$view->addData('supplier', $supplier);
$view->data['supplier'] = $supplier;
return $view;
}
@ -177,7 +177,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/SupplierManagement/Theme/Backend/supplier-create');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1003202001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003202001, $request, $response);
return $view;
}
@ -197,14 +197,14 @@ final class BackendController extends Controller
public function viewSupplierManagementSupplierProfile(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
{
/** @var \phpOMS\Model\Html\Head $head */
$head = $response->get('Content')->getData('head');
$head = $response->get('Content')->head;
$head->addAsset(AssetType::CSS, 'Resources/chartjs/Chartjs/chart.css');
$head->addAsset(AssetType::JSLATE, 'Resources/chartjs/Chartjs/chart.js');
$head->addAsset(AssetType::JSLATE, 'Modules/SupplierManagement/Controller.js', ['type' => 'module']);
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/SupplierManagement/Theme/Backend/supplier-profile');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1003202001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003202001, $request, $response);
/** @var \Modules\SupplierManagement\Models\Supplier $supplier */
$supplier = SupplierMapper::get()
@ -216,7 +216,7 @@ final class BackendController extends Controller
->where('id', (int) $request->getData('id'))
->execute();
$view->setData('supplier', $supplier);
$view->data['supplier'] = $supplier;
// stats
if ($this->app->moduleManager->isActive('Billing')) {
@ -233,11 +233,11 @@ final class BackendController extends Controller
$monthlyPurchaseCosts = [];
}
$view->addData('ytd', $ytd);
$view->addData('mtd', $mtd);
$view->addData('lastOrder', $lastOrder);
$view->addData('newestInvoices', $newestInvoices);
$view->addData('monthlyPurchaseCosts', $monthlyPurchaseCosts);
$view->data['ytd'] = $ytd;
$view->data['mtd'] = $mtd;
$view->data['lastOrder'] = $lastOrder;
$view->data['newestInvoices'] = $newestInvoices;
$view->data['monthlyPurchaseCosts'] = $monthlyPurchaseCosts;
return $view;
}

View File

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

View File

@ -14,10 +14,10 @@ declare(strict_types=1);
use phpOMS\Localization\ISO639Enum;
$attribute = $this->getData('attribute');
$l11ns = $this->getData('l11ns');
$attribute = $this->data['attribute'];
$l11ns = $this->data['l11ns'];
echo $this->getData('nav')->render(); ?>
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-md-6 col-xs-12">

View File

@ -15,7 +15,7 @@ declare(strict_types=1);
/**
* @var \phpOMS\Views\View $this
*/
echo $this->getData('nav')->render(); ?>
echo $this->data['nav']->render(); ?>
<div class="tabview tab-2">
<div class="box">

View File

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

View File

@ -21,17 +21,17 @@ $countries = \phpOMS\Localization\ISO3166NameEnum::getConstants();
/**
* @var \Modules\SupplierManagement\Models\Supplier $supplier
*/
$supplier = $this->getData('supplier');
$supplier = $this->data['supplier'];
$notes = $supplier->getNotes();
$files = $supplier->files;
$newestInvoices = $this->getData('newestInvoices') ?? [];
$monthlyPurchaseCosts = $this->getData('monthlyPurchaseCosts') ?? [];
$newestInvoices = $this->data['newestInvoices'] ?? [];
$monthlyPurchaseCosts = $this->data['monthlyPurchaseCosts'] ?? [];
/**
* @var \phpOMS\Views\View $this
*/
echo $this->getData('nav')->render();
echo $this->data['nav']->render();
?>
<div class="tabview tab-2">
<div class="box">