48 lines
1.4 KiB
PHP
48 lines
1.4 KiB
PHP
<?php
|
|
namespace Stemcell\Customer\Controller\Adminhtml\Salesperson;
|
|
|
|
use Magento\Backend\App\Action\Context;
|
|
use Magento\Framework\App\Action\HttpGetActionInterface;
|
|
use Magento\Framework\Controller\ResultInterface;
|
|
use Magento\Framework\Exception\LocalizedException;
|
|
use Magento\Framework\Exception\NoSuchEntityException;
|
|
use Magento\Framework\View\Result\PageFactory;
|
|
use Stemcell\Customer\Model\SalespersonRepository;
|
|
|
|
class Edit extends \Magento\Backend\App\Action implements HttpGetActionInterface
|
|
{
|
|
|
|
/**
|
|
* @var PageFactory
|
|
*/
|
|
protected PageFactory $resultPageFactory;
|
|
protected SalespersonRepository $repository;
|
|
|
|
public function __construct(
|
|
Context $context,
|
|
PageFactory $resultPageFactory,
|
|
SalespersonRepository $repository
|
|
) {
|
|
parent::__construct($context);
|
|
$this->resultPageFactory = $resultPageFactory;
|
|
$this->repository = $repository;
|
|
}
|
|
|
|
/**
|
|
* Execute view action
|
|
*
|
|
* @return ResultInterface
|
|
* @throws LocalizedException
|
|
*/
|
|
public function execute()
|
|
{
|
|
try {
|
|
$salesperson = $this->repository->get($this->getRequest()->getParam('id'))->getData();
|
|
} catch (NoSuchEntityException $e) {
|
|
$salesperson = [];
|
|
}
|
|
$this->_getSession()->setSalesperson($salesperson);
|
|
return $this->resultPageFactory->create();
|
|
}
|
|
}
|