init
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\CustomerVat\Controller\Adminhtml\Application;
|
||||
|
||||
use Esun\CustomerVat\Model\ResourceModel\VatApplication as VatResource;
|
||||
use Esun\CustomerVat\Model\VatApplicationFactory;
|
||||
use Magento\Backend\App\Action;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\Registry;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
|
||||
class View extends Action
|
||||
{
|
||||
public const ADMIN_RESOURCE = 'Esun_CustomerVat::applications';
|
||||
|
||||
public function __construct(Context $context, private readonly PageFactory $pageFactory,
|
||||
private readonly VatApplicationFactory $factory, private readonly VatResource $resource,
|
||||
private readonly Registry $registry)
|
||||
{
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$application = $this->factory->create();
|
||||
$this->resource->load($application, (int)$this->getRequest()->getParam('id'));
|
||||
if (!$application->getId()) {
|
||||
$this->messageManager->addErrorMessage(__('The VAT application no longer exists.'));
|
||||
return $this->resultRedirectFactory->create()->setPath('*/*/index');
|
||||
}
|
||||
$this->registry->register('current_customer_vat_admin', $application);
|
||||
$page = $this->pageFactory->create();
|
||||
$page->setActiveMenu('Esun_CustomerVat::applications');
|
||||
$page->getConfig()->getTitle()->prepend(__('VAT Application #%1', $application->getId()));
|
||||
return $page;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user