searchParamsFetcher->fetch($request); $offset = $searchParamsAux->getOffset(); $maxSize = $searchParamsAux->getMaxSize(); $after = $request->getQueryParam('after'); $searchParams = SearchParams ::create() ->withOffset($offset) ->withMaxSize($maxSize); if ($after) { $searchParams = $searchParams ->withWhereAdded( WhereItem ::createBuilder() ->setAttribute('createdAt') ->setType(WhereItem\Type::AFTER) ->setValue($after) ->build() ); } $userId = $this->user->getId(); $recordCollection = $this->getNotificationService()->get($userId, $searchParams); return (object) [ 'total' => $recordCollection->getTotal(), 'list' => $recordCollection->getValueMapList(), ]; } public function getActionNotReadCount(): int { $userId = $this->user->getId(); return $this->getNotificationService()->getNotReadCount($userId); } public function postActionMarkAllRead(Request $request): bool { $userId = $this->user->getId(); $this->getNotificationService()->markAllRead($userId); return true; } private function getNotificationService(): Service { return $this->injectableFactory->create(Service::class); } }