API page: http://api.drupal.org/api/drupal/includes--pager.inc/function/PagerDefau...

Describe the problem you have found:

Parameters docs say: "$limit An integer specifying the number of elements per page. If passed a false value (FALSE, 0, NULL), the pager is disabled."

Reading the above, I assumed setting $limit to a false value would disable the pager and return all results. In fact, PagerDefault::execute returns no results when $limit is a false value, it simply returns. According to ::execute()'s docs, however, returning no results appears to be intentional...

If that's the case and returning no results when $limit is a false value is the expected behavior, it would be clearer I think if the docs for ::limit() say something along the lines of "If passed a false value (FALSE, 0, NULL), the query will return no results."

Or if setting limit to FALSE should disable the pager and return *all* results as the docs for this function imply, PagerDisplay::execute needs to be patched.

Anyone know which is the way to go?

Comments

jhodgdon’s picture

Title: Documentation problem with DBTNG's PagerDefault::limit » DBTNG's PagerDefault::limit() function doc for FALSE values doesn't correspond with the code
Version: 7.x-dev » 8.x-dev
Issue tags: +Novice, +Needs backport to D7

Agreed. The execute function has this comment in the code:

// A NULL limit is the "kill switch" for pager queries.
  if (empty($this->limit)) {
    return;
  }

The documentation for the ::limit() method needs to correspond. I think the doc for the $limit parameter should mention this too.

I like the suggestion above:

"If passed a false value (FALSE, 0, NULL), the query will return no results."

Just needs a patch, and needs to be d8 first, then backported to d7.

damien tournoud’s picture

Status: Active » Closed (duplicate)