I am trying to complete an eager-loading query that will pull in all the related fields on an Entry, even if they are disabled.
I am using this as a reference in the docs: https://craftcms.com/docs/3.x/dev/eager-loading-elements.html#defining-custom-parameters-on-eager-loaded-elements
I wrote this:
$facility = Entry::find()
->id($entryId)
->with([
['services', {status: null}],
['conditions', {status: null}]
])
->status(null)
->one();
But I keep getting a syntax error
syntax error, unexpected '{', expecting ']'
Does anyone know what I am doing wrong and why? TIA!
Syntax incantation issue. I was trying to write a Craft query in a PHP module. PHP doesn't want to see curly bois. The corrected code below works!
$facility = Entry::find()
->id($entryId)
->with([
['services', ['status' => null]],
['conditions', ['status' => null]],
])
->status(null)
->one();
Hope this helps someone in the future!