From f78468c8835fe3acfcf957c304d867654ce47774 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Mon, 11 Feb 2019 15:08:42 -0600 Subject: [PATCH] docs: note that setFirstResult() SHOULD NOT be called It is called by the ExtractCollection trait, using the discovered page number and number of results to retrieve. --- docs/book/doctrine.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/book/doctrine.md b/docs/book/doctrine.md index 985554a..21b1644 100644 --- a/docs/book/doctrine.md +++ b/docs/book/doctrine.md @@ -365,6 +365,16 @@ seed a collection paginator (in the case of the `ListAlbumsHandler`). These values are known by the metadata map, and, as such, we can generate HAL resources for them without needing any other information. +> ### Setting the offset +> +> When you plan to use paginated Doctrine result sets, you DO NOT need to +> call `$query->setFirstResult()`. This will be called when generating the +> result set based on the current page and the value of +> `$query->getMaxResults()`. +> +> You MUST call `$query->setMaxResults()` prior to generating your resource if +> you want it to be paginated, however. + ## Example: Doctrine Collections Sometimes we will want to return an entire collection at once. The `getResult()`