Skip to content

doc: recipes, pager template types and styling - #61

Merged
kbond merged 4 commits into
zenstruck:1.xfrom
kbond:doc/misc
Aug 21, 2026
Merged

kbond merged 4 commits into
zenstruck:1.xfrom
kbond:doc/misc

Conversation

@kbond

@kbond kbond commented Aug 21, 2026

Copy link
Copy Markdown
Member

A few documentation follow-ups to #60.

  • A Recipes section, working through the same problem three ways: iterating GitHub's issue search with a LazyCollection, making it countable with CallbackCollection, then wrapping it in a custom Collection that overrides count() and take() so the API's own paging is used. Each recipe names what the previous one can't do cheaply. The request counts in it are measured, not guessed.
  • A pages() caveat. "Each page is a separate query" was only true for Doctrine - a source that reaches an offset by skipping re-reads everything before each page, so walking 2,000 items in pages of 100 costs 249 reads instead of 20. That's now stated, with a pointer to the recipe that fixes it.
  • Pager template variables are documented with Twig's types tag and documentation comments, so the Symfony language tools can offer completion and hover. This needs twig/twig 3.13+, hence the dev constraint - the only non-doc change here.
  • A short Tailwind example for styling the pager templates via the classes they emit, plus a pointer to it from the templating section.
  • Dropped the Page::hasMorePages() row from the lazy/eager table - it's a table of Collection methods.

kbond added 4 commits August 21, 2026 11:19
It's a table about `Collection` methods - what a `Page` reads is covered in the pagination section.
Two worked examples for the non-database case: iterating a paginated API with `LazyCollection`, and making that countable with `CallbackCollection` when the API reports a total.
Declares each variable's type and purpose with Twig's `types` tag and documentation comments, which the Symfony language tools use for completion and hover. Requires `twig/twig` 3.13+, so the dev constraint pins it.
The class names the templates emit are the styling hooks - a short Tailwind example, and a pointer to it from the templating section.
@kbond
kbond merged commit 68aeab8 into zenstruck:1.x Aug 21, 2026
18 checks passed
@kbond
kbond deleted the doc/misc branch August 21, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant