Answers.Body: <p>The right Field ID to add is the <code>Matrix</code> field id as defined in the <code>Fields</code> section.  Do not use the ids of the matrix block fields.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-21T05:27:01.173Z
Answers.LastActivityDate: 2018-06-21T05:27:01.173Z
Answers.UserDisplayName: biko
Body: <pre><code>$blocks = MatrixBlock::find()-&gt;relatedTo($entry)-&gt;all();
  </code></pre>
  
  <p>The above returns the correct blocks but all fields are returned as NULL.</p>
  
  <p>I've read over at <a href="https://github.com/craftcms/cms/issues/1789" rel="nofollow noreferrer">GitHub</a> that we need to specify a fieldId param but can't seem to figure out how.  The below e.g. doesn't work:</p>
  
  <pre><code>$blocks = MatrixBlock::find()-&gt;relatedTo($entry)-&gt;fieldId([33])-&gt;all();
  </code></pre>
  
  <p>Help anyone?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-06-21T05:00:17.043Z
Comments.Text: Is your field id correct? You need to insert an id and not an array
Comments.UserDisplayName: Robin Schambach
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-06-21T05:25:59.983Z
Comments.Text: @RobinSchambach Ah yes my field id was wrong...  I was adding the field id of the matrix block.  The right ID to add is the Matrix field id as defined in the Fields section.  Thank you!
Comments.UserDisplayName: biko
Tags: <matrix><craft3><plugin-elementapi><query>
Title: Matrix block fields returning NULL when using MatrixBlock query
ThreadText: # Matrix block fields returning NULL when using MatrixBlock query
  
  (Asked by: username_0 on 2018-06-21)
  
  ```
  $blocks = MatrixBlock::find()->relatedTo($entry)->all();
  
  ```
  
  The above returns the correct blocks but all fields are returned as NULL.
  
  I've read over at [GitHub](https://github.com/craftcms/cms/issues/1789) that we need to specify a fieldId param but can't seem to figure out how. The below e.g. doesn't work:
  
  ```
  $blocks = MatrixBlock::find()->relatedTo($entry)->fieldId([33])->all();
  
  ```
  
  Help anyone?
  
  **Tags:** matrix, craft3, plugin-elementapi, query
  
  > **Comments:**
  > **username_1**: Is your field id correct? You need to insert an id and not an array  
  > **username_0**: @username_1 Ah yes my field id was wrong...  I was adding the field id of the matrix block.  The right ID to add is the Matrix field id as defined in the Fields section.  Thank you!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-06-21. Score: 1
  
  The right Field ID to add is the `Matrix` field id as defined in the `Fields` section. Do not use the ids of the matrix block fields.
  
  
  ---
  
  