Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing array of ID(s) in fieldId param in Matrix Block queries does not return custom field content #5388

Open
chasegiunta opened this issue Dec 31, 2019 · 2 comments

Comments

@chasegiunta
Copy link
Contributor

@chasegiunta chasegiunta commented Dec 31, 2019

Description

In Craft 2, I'm 90% sure you could pass multiple fieldId's in Matrix Block queries to return their custom field content.

In Craft 3, while you can return custom field content with a sole field ID, placing that field ID in an array, or passing multiple within an array, will not return the custom field content.

Is this functionality being removed intentional?

Steps to reproduce

  1. $matrixFieldOne = Craft::$app->fields->getFieldByHandle('matrixOne')->id;
    $blocks = MatrixBlock::find()
        ->type('blockTypeA')
        ->fieldId([$matrixFieldOne])
        ->all();
  2. Loop $blocks, attempt to grab a plaintext field content, observe nothing ;-)

  3. $matrixFieldOne = Craft::$app->fields->getFieldByHandle('matrixOne')->id;
    $blocks = MatrixBlock::find()
        ->type('blockTypeA')
        ->fieldId($matrixFieldOne)
        ->all();
  4. Loop $blocks, attempt to grab a plaintext field content, observe 'dat content.

Additional info

  • Craft version: 3.3.18.4
  • PHP version: 7.3
@brandonkelly

This comment has been minimized.

Copy link
Member

@brandonkelly brandonkelly commented Jan 2, 2020

This was also the case in Craft 2, and the reason for it is that each Matrix gets its own content table, and element queries aren’t currently able to pull in content from multiple content tables at the same time.

I will leave this open though, as this is something we hope to make possible in Craft 4.

@chasegiunta

This comment has been minimized.

Copy link
Contributor Author

@chasegiunta chasegiunta commented Jan 3, 2020

~ walks back that whole 90% sure claim ~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.