diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 2ca5450..bb8259d 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -68,7 +68,7 @@ final class ApiController extends Controller public function apiSupplierCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateSupplierCreate($request))) { - $response->set('supplier_create', new FormValidation($val)); + $response->data['supplier_create'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -148,7 +148,7 @@ final class ApiController extends Controller public function apiSupplierL11nCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateSupplierL11nCreate($request))) { - $response->set('supplier_l11n_create', new FormValidation($val)); + $response->data['supplier_l11n_create'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -174,7 +174,7 @@ final class ApiController extends Controller $supplierL11n->ref = $request->getDataInt('supplier') ?? 0; $supplierL11n->type = new NullBaseStringL11nType($request->getDataInt('type') ?? 0); $supplierL11n->setLanguage( - $request->getDataString('language') ?? $request->getLanguage() + $request->getDataString('language') ?? $request->header->l11n->language ); $supplierL11n->content = $request->getDataString('description') ?? ''; @@ -219,7 +219,7 @@ final class ApiController extends Controller public function apiSupplierL11nTypeCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateSupplierL11nTypeCreate($request))) { - $response->set('supplier_l11n_type_create', new FormValidation($val)); + $response->data['supplier_l11n_type_create'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -283,7 +283,7 @@ final class ApiController extends Controller public function apiSupplierAttributeCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateSupplierAttributeCreate($request))) { - $response->set('attribute_create', new FormValidation($val)); + $response->data['attribute_create'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -351,7 +351,7 @@ final class ApiController extends Controller public function apiSupplierAttributeTypeL11nCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateSupplierAttributeTypeL11nCreate($request))) { - $response->set('attr_type_l11n_create', new FormValidation($val)); + $response->data['attr_type_l11n_create'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -376,7 +376,7 @@ final class ApiController extends Controller $attrL11n = new BaseStringL11n(); $attrL11n->ref = $request->getDataInt('type') ?? 0; $attrL11n->setLanguage( - $request->getDataString('language') ?? $request->getLanguage() + $request->getDataString('language') ?? $request->header->l11n->language ); $attrL11n->content = $request->getDataString('title') ?? ''; @@ -420,7 +420,7 @@ final class ApiController extends Controller public function apiSupplierAttributeTypeCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateSupplierAttributeTypeCreate($request))) { - $response->set('attr_type_create', new FormValidation($val)); + $response->data['attr_type_create'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -491,7 +491,7 @@ final class ApiController extends Controller public function apiSupplierAttributeValueCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateSupplierAttributeValueCreate($request))) { - $response->set('attr_value_create', new FormValidation($val)); + $response->data['attr_value_create'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -576,7 +576,7 @@ final class ApiController extends Controller public function apiSupplierAttributeValueL11nCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateSupplierAttributeValueL11nCreate($request))) { - $response->set('attr_value_l11n_create', new FormValidation($val)); + $response->data['attr_value_l11n_create'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -601,7 +601,7 @@ final class ApiController extends Controller $attrL11n = new BaseStringL11n(); $attrL11n->ref = $request->getDataInt('value') ?? 0; $attrL11n->setLanguage( - $request->getDataString('language') ?? $request->getLanguage() + $request->getDataString('language') ?? $request->header->l11n->language ); $attrL11n->content = $request->getDataString('title') ?? ''; @@ -644,7 +644,7 @@ final class ApiController extends Controller */ public function apiFileCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { - $uploadedFiles = $request->getFiles(); + $uploadedFiles = $request->files; if (empty($uploadedFiles)) { $this->fillJsonResponse($request, $response, NotificationLevel::ERROR, 'Item', 'Invalid supplier image', $uploadedFiles); diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 8c020c1..03c3b35 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -55,15 +55,15 @@ 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() ->with('l11n') - ->where('l11n/language', $response->getLanguage()) + ->where('l11n/language', $response->header->l11n->language) ->execute(); - $view->addData('attributes', $attributes); + $view->data['attributes'] = $attributes; return $view; } @@ -84,15 +84,15 @@ 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() ->with('l11n') - ->where('l11n/language', $response->getLanguage()) + ->where('l11n/language', $response->header->l11n->language) ->execute(); - $view->addData('attributes', $attributes); + $view->data['attributes'] = $attributes; return $view; } @@ -113,21 +113,21 @@ 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() ->with('l11n') ->where('id', (int) $request->getData('id')) - ->where('l11n/language', $response->getLanguage()) + ->where('l11n/language', $response->header->l11n->language) ->execute(); $l11ns = SupplierAttributeTypeL11nMapper::getAll() ->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; } diff --git a/Theme/Backend/attribute-type-list.tpl.php b/Theme/Backend/attribute-type-list.tpl.php index 52ccbc2..ef2e5db 100644 --- a/Theme/Backend/attribute-type-list.tpl.php +++ b/Theme/Backend/attribute-type-list.tpl.php @@ -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(); ?>
diff --git a/Theme/Backend/attribute-type.tpl.php b/Theme/Backend/attribute-type.tpl.php index a1980a0..3d003e3 100755 --- a/Theme/Backend/attribute-type.tpl.php +++ b/Theme/Backend/attribute-type.tpl.php @@ -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(); ?>
diff --git a/Theme/Backend/supplier-create.tpl.php b/Theme/Backend/supplier-create.tpl.php index e422c1b..0be9407 100755 --- a/Theme/Backend/supplier-create.tpl.php +++ b/Theme/Backend/supplier-create.tpl.php @@ -15,7 +15,7 @@ declare(strict_types=1); /** * @var \phpOMS\Views\View $this */ -echo $this->getData('nav')->render(); ?> +echo $this->data['nav']->render(); ?>
diff --git a/Theme/Backend/supplier-list.tpl.php b/Theme/Backend/supplier-list.tpl.php index 053bc40..8897a63 100755 --- a/Theme/Backend/supplier-list.tpl.php +++ b/Theme/Backend/supplier-list.tpl.php @@ -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(); ?>
diff --git a/Theme/Backend/supplier-profile.tpl.php b/Theme/Backend/supplier-profile.tpl.php index 4d91b83..da15cf6 100755 --- a/Theme/Backend/supplier-profile.tpl.php +++ b/Theme/Backend/supplier-profile.tpl.php @@ -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->getFiles(); +$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(); ?>
diff --git a/tests/Models/SupplierTest.php b/tests/Models/SupplierTest.php index 52f28a6..8fc4cb7 100755 --- a/tests/Models/SupplierTest.php +++ b/tests/Models/SupplierTest.php @@ -48,7 +48,7 @@ final class SupplierTest extends \PHPUnit\Framework\TestCase self::assertEquals(SupplierStatus::ACTIVE, $this->supplier->getStatus()); self::assertEquals(0, $this->supplier->getType()); self::assertEquals([], $this->supplier->getNotes()); - self::assertEquals([], $this->supplier->getFiles()); + self::assertEquals([], $this->supplier->files); self::assertEquals([], $this->supplier->getAddresses()); self::assertEquals([], $this->supplier->getContactElements()); self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $this->supplier->createdAt->format('Y-m-d')); @@ -84,7 +84,7 @@ final class SupplierTest extends \PHPUnit\Framework\TestCase public function testFileInputOutput() : void { $this->supplier->addFile($temp = new Media()); - self::assertCount(1, $this->supplier->getFiles()); + self::assertCount(1, $this->supplier->files); } /**