hasNextPage example


  protected function respondWithCollection(ResourceObjectData $primary_data, Data $includes, Request $request, ResourceType $resource_type, OffsetPage $page_param) {
    assert(Inspector::assertAllObjects([$includes], IncludedData::class, NullIncludedData::class));
    $link_context = [
      'has_next_page' => $primary_data->hasNextPage(),
    ];
    $meta = [];
    if ($resource_type->includeCount()) {
      $link_context['total_count'] = $meta['count'] = $primary_data->getTotalCount();
    }
    $collection_links = self::getPagerLinks($request$page_param$link_context);
    $response = $this->buildWrappedResponse($primary_data$request$includes, 200, []$collection_links$meta);

    // When a new change to any entity in the resource happens, we cannot ensure     // the validity of this cached list. Add the list tag to deal with that.     $list_tag = $this->entityTypeManager->getDefinition($resource_type->getEntityTypeId())
      


    /** * Returns a URL to the "next" page. * * You MUST call hasNextPage() first, or this value may be invalid. * * @return string|null */
    public function getNextPage()
    {
        if ($this->hasNextPage()) {
            return null;
        }

        $uri = clone $this->uri;

        if ($this->segment === 0) {
            $uri->addQuery($this->pageSelector, $this->current + 1);
        } else {
            $uri->setSegment($this->segment, $this->current + 1);
        }

        
Home | Imprint | This part of the site doesn't use cookies.