I'm trying to eager-load a Matrix field with it's blocktype and related field types. For some reason the _eagerLoadedBlockTypeElements are empty arrays.

If I get rid of the with clause on ElementCriteria and iterate through the items it does work, which is not surprising.

The code I have right now (including dumping the results) are below.

$criteria = craft()->elements->getCriteria(ElementType::GlobalSet, [
        'handle' => 'footer',
        'with'   => ['column1Items.item:itemSection', 'column1Items.item:itemTitle']

$found = $criteria->first();

I'm fairly new to Craft and working with Yii hopefully someone can help me out with this one!


P.S. I can dump the query logs if necessary, just shoot!

  • I've just run in to this same issue, no luck in my troubleshooting so far. – tekstrand Jul 20 '18 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.