You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a page has a PageTable field and it's joined with e.g. $p = $pages->get('id=42, field=my_pagetable_field'), the resulting $p->my_pagetable_field is empty when the field contains exactly one page.
Expected behavior
Adding field=... should not affect the result, only performance.
Short description of the issue
When a page has a PageTable field and it's joined with e.g.
$p = $pages->get('id=42, field=my_pagetable_field')
, the resulting$p->my_pagetable_field
is empty when the field contains exactly one page.Expected behavior
Adding
field=...
should not affect the result, only performance.Actual behavior
The only subpage is not fetched.
Screenshots/Links that demonstrate the issue
Possible cause: when the database query returns exactly one subpage,
is_array
returnsfalse
here:https://github.com/processwire/processwire/blob/master/wire/modules/Fieldtype/FieldtypePageTable.module#L452
Steps to reproduce the issue
The script below creates a parent and child template,
p
andc
, and a fieldc_ref
in thep
template. Then it adds these pages:If run without GET params, it fetches all the pages and prints the above output. If run with
?join
, the lone childchild-b1
is not printed.Setup/Environment
The script:
The text was updated successfully, but these errors were encountered: