generated from spatie/package-skeleton-php
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
Hi!
What is best way for implement tag 'paginate' with collection(from DB)?
When adding 'metaobjects' Drop (proxy to DB) in assigns,
$assigns = compact(
'metaobjects'
);
$sectionContext = $environment->newRenderContext( data: $assigns );
and then use template
{% paginate metaobjects[type].values by 3 %}
{% for m in metaobjects[type].values %}
<p>{{ m.title }}</p>
{% endfor %}
{% endpaginate %}
It's show only 3 from many, it's ok, but when in template need access to original collection outside paginate, like this
<p>test assign [type] limit 5</p>
{%- assign mo_collection = metaobjects[type].values -%}
{%- for mo in mo_collection limit: 5-%}
<p>{{ mo.title }}</p>
{%- endfor -%}
I get only three objects, not five from original proxy (it's emulate shopify collections, if direct access - first page with 250 and sort by title asc)
In Paginate tag I put 'metaobjects' array(not proxy) to ActiveScope.
$context->setToActiveScope($rootName, $items);
Also tried $context->set($varName, $items);
but no luck.
I will appreciate any thought to resolve this thing.
How to reproduce the bug
n\a
Package Version
0.9
PHP Version
8.2
Which operating systems does with happen with?
No response
Notes
sorry for using bug report, QA issue template is get 404 from GitHub.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working