. */ namespace SP\Modules\Web\Controllers\Account; use Exception; use SP\Core\Acl\AclActionsInterface; use SP\Core\Events\Event; use SP\Util\ErrorUtil; /** * Class EditController */ final class EditController extends AccountViewBase { /** * Edit action * * @param int $id Account's ID */ public function editAction(int $id): void { try { $accountEnrichedDto = $this->accountService->getByIdEnriched($id); $accountEnrichedDto = $this->accountService->withUsers($accountEnrichedDto); $accountEnrichedDto = $this->accountService->withUserGroups($accountEnrichedDto); $accountEnrichedDto = $this->accountService->withTags($accountEnrichedDto); $this->accountHelper->setViewForAccount($accountEnrichedDto, AclActionsInterface::ACCOUNT_EDIT); $this->view->addTemplate('account'); $this->view->assign( 'title', [ 'class' => 'titleOrange', 'name' => __('Edit Account'), 'icon' => $this->icons->getIconEdit()->getIcon(), ] ); $this->view->assign('formRoute', 'account/saveEdit'); $this->accountService->incrementViewCounter($id); $this->eventDispatcher->notify('show.account.edit', new Event($this)); if ($this->isAjax === false) { $this->upgradeView(); } $this->view(); } catch (Exception $e) { processException($e); $this->eventDispatcher->notify('exception', new Event($e)); if ($this->isAjax === false && !$this->view->isUpgraded()) { $this->upgradeView(); } ErrorUtil::showExceptionInView($this->view, $e, 'account'); } } }