. */ namespace SP\Modules\Web\Controllers\Items; use SP\Core\Application; use SP\Domain\Client\Ports\ClientServiceInterface; use SP\Http\Json; use SP\Modules\Web\Controllers\SimpleControllerBase; use SP\Mvc\Controller\SimpleControllerHelper; use SP\Mvc\View\Components\SelectItemAdapter; /** * Class ClientsController */ final class ClientsController extends SimpleControllerBase { private ClientServiceInterface $clientService; public function __construct( Application $application, SimpleControllerHelper $simpleControllerHelper, ClientServiceInterface $clientService ) { parent::__construct($application, $simpleControllerHelper); $this->checks(); $this->clientService = $clientService; } /** * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException * @throws \SP\Core\Exceptions\SPException */ public function clientsAction(): void { Json::factory($this->router->response()) ->returnRawJson(SelectItemAdapter::factory($this->clientService->getAllForUser())->getJsonItemsFromModel()); } }