* [MOD] Improved IoC handling. Work in progress

This commit is contained in:
nuxsmin
2018-02-14 00:24:35 +01:00
parent f25b860a8e
commit 674c9154b7
58 changed files with 781 additions and 881 deletions

View File

@@ -30,7 +30,6 @@ use SP\Core\Acl\Acl;
use SP\Core\Acl\ActionsInterface;
use SP\Core\Exceptions\SPException;
use SP\Core\Exceptions\ValidationException;
use SP\Core\SessionUtil;
use SP\DataModel\ClientData;
use SP\Forms\ClientForm;
use SP\Http\JsonResponse;
@@ -59,6 +58,8 @@ class ClientController extends ControllerBase implements CrudControllerInterface
/**
* Search action
*
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws \SP\Core\Dic\ContainerException
*/
public function searchAction()
@@ -67,7 +68,7 @@ class ClientController extends ControllerBase implements CrudControllerInterface
return;
}
$itemsGridHelper = new ItemsGridHelper($this->view, $this->config, $this->session, $this->eventDispatcher);
$itemsGridHelper = $this->dic->get(ItemsGridHelper::class);
$grid = $itemsGridHelper->getClientsGrid($this->clientService->search($this->getSearchData($this->configData)))->updatePager();
$this->view->addTemplate('datagrid-table', 'grid');
@@ -118,7 +119,7 @@ class ClientController extends ControllerBase implements CrudControllerInterface
$this->view->assign('client', $client);
$this->view->assign('sk', SessionUtil::getSessionKey(true));
$this->view->assign('sk', $this->session->generateSecurityKey());
$this->view->assign('nextAction', Acl::getActionRoute(ActionsInterface::ITEMS_MANAGE));
if ($this->view->isView === true) {
@@ -187,6 +188,8 @@ class ClientController extends ControllerBase implements CrudControllerInterface
/**
* Saves create action
*
* @throws \SP\Core\Dic\ContainerException
*/
public function saveCreateAction()
{
@@ -216,6 +219,7 @@ class ClientController extends ControllerBase implements CrudControllerInterface
* Saves edit action
*
* @param $id
* @throws \SP\Core\Dic\ContainerException
*/
public function saveEditAction($id)
{
@@ -270,13 +274,14 @@ class ClientController extends ControllerBase implements CrudControllerInterface
/**
* Initialize class
*
* @throws \SP\Core\Dic\ContainerException
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
protected function initialize()
{
$this->checkLoggedIn();
$this->clientService = new ClientService();
$this->clientService = $this->dic->get(ClientService::class);
}
}