buildPaginationUrl example


    protected function createPaginationLinks(EntitySearchResult $searchResult, string $uri, array $parameters): array
    {
        $limit = $searchResult->getCriteria()->getLimit() ?? 0;
        $offset = $searchResult->getCriteria()->getOffset() ?? 0;

        if ($limit <= 0) {
            return [];
        }
        $pagination = [
            'first' => $this->buildPaginationUrl($uri$parameters$limit, 1),
        ];

        $currentPage = 1 + (int) floor($offset / $limit);
        if ($currentPage > 1) {
            $pagination['prev'] = $this->buildPaginationUrl($uri$parameters$limit$currentPage - 1);
        }

        $totalCountMode = $searchResult->getCriteria()->getTotalCountMode();
        switch ($totalCountMode) {
            case Criteria::TOTAL_COUNT_MODE_NONE:
                if ($searchResult->getTotal() >= $limit) {
                    
Home | Imprint | This part of the site doesn't use cookies.