. */ namespace SP\Modules\Web\Controllers\Account; use Exception; use SP\Core\Application; use SP\Core\Events\Event; use SP\Modules\Web\Controllers\Helpers\Account\AccountSearchHelper; use SP\Modules\Web\Controllers\Traits\JsonTrait; use SP\Mvc\Controller\WebControllerHelper; /** * SearchController */ final class SearchController extends AccountControllerBase { use JsonTrait; private AccountSearchHelper $accountSearchHelper; public function __construct( Application $application, WebControllerHelper $webControllerHelper, AccountSearchHelper $accountSearchHelper ) { parent::__construct( $application, $webControllerHelper ); $this->accountSearchHelper = $accountSearchHelper; } /** * @return bool * @throws \JsonException */ public function searchAction(): ?bool { try { $this->accountSearchHelper->getAccountSearch(); $this->eventDispatcher->notify('show.account.search', new Event($this)); return $this->returnJsonResponseData(['html' => $this->render()]); } catch (Exception $e) { processException($e); $this->eventDispatcher->notify('exception', new Event($e)); return $this->returnJsonResponseException($e); } } }