<p>This was a bug in a beta version of Craft 3 (fixed here: <a href="https://github.com/craftcms/cms/commit/9b6dad7385c5a82d1c83d230fe6ce0cfe940675b" rel="nofollow noreferrer">https://github.com/craftcms/cms/commit/9b6dad7385c5a82d1c83d230fe6ce0cfe940675b</a>)</p>

CC BY-SA 3.0
2017-07-20T06:37:51.750Z
2017-07-20T06:37:51.750Z
Matthias Redl-Mann
<p>I'm using Craft Pro 3.0.0-beta.19 and I try to query matrix blocks with craft.matrixBlocks(). Background: I have event series (=structure) with a matrix block containing 1:n dates for each series. My block type in the "dates" matrix block is "eventDate" and looks like this: <a href="https://i.sstatic.net/ror05.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ror05.png" alt="Block Definition"></a></p>

<p>this works:</p>

<p><code>{% set entries = craft.matrixBlocks() %}</code></p>

<p>Since this is the first matrix block I have I get all the entries I have (2):</p>

<p><code>{{ entries | length }}</code> will output: 2
<code>{{ entries.one().type }}</code> will output: eventDate</p>

<p>Good.</p>

<p>Now I want to limit the blocks to eventDate only</p>

<p><code>{% set entries = craft.matrixBlocks.type('eventDate') %}</code></p>

<p>On the first glance this seems to work, I get the same results.</p>

<p>But when I change this to</p>

<p><code>{% set entries = craft.matrixBlocks.type('WhateverGoesHere') %}</code></p>

<p>I still get the same results. Am i not understanding this or is it a bug?</p>

<p>Thanks,
Matthias</p>

CC BY-SA 3.0
2017-06-22T14:48:57.653Z
I really assume this is a bug. Also accessing the fields does not work, I posted an issue ticket on Github: https://github.com/craftcms/cms/issues/1789
Matthias Redl-Mann
CC BY-SA 3.0
2017-06-23T03:51:19.910Z
Curious if you get the same behavior on Craft 2 as well...
Brad Bell
CC BY-SA 3.0
2017-06-23T06:45:48.157Z
Did craft.matrixBlocks exist on Craft 2?
Matthias Redl-Mann
CC BY-SA 3.0
2017-06-24T03:06:48.907Z
Duh... nope it doesn't.
Brad Bell
<elementcriteriamodel><query><block-types>
craft.matrixBlocks element queries with .type()
# craft.matrixBlocks element queries with .type()

(Asked by: username_0 on 2017-06-22)

I'm using Craft Pro 3.0.0-beta.19 and I try to query matrix blocks with craft.matrixBlocks(). Background: I have event series (=structure) with a matrix block containing 1:n dates for each series. My block type in the "dates" matrix block is "eventDate" and looks like this: [![Block Definition](https://i.sstatic.net/ror05.png)](https://i.sstatic.net/ror05.png)

this works:

`{% set entries = craft.matrixBlocks() %}`

Since this is the first matrix block I have I get all the entries I have (2):

`{{ entries | length }}` will output: 2
`{{ entries.one().type }}` will output: eventDate

Good.

Now I want to limit the blocks to eventDate only

`{% set entries = craft.matrixBlocks.type('eventDate') %}`

On the first glance this seems to work, I get the same results.

But when I change this to

`{% set entries = craft.matrixBlocks.type('WhateverGoesHere') %}`

I still get the same results. Am i not understanding this or is it a bug?

Thanks,
Matthias

**Tags:** elementcriteriamodel, query, block-types

> **Comments:**
> **username_0**: I really assume this is a bug. Also accessing the fields does not work, I posted an issue ticket on Github: https://github.com/craftcms/cms/issues/1789  
> **username_1**: Curious if you get the same behavior on Craft 2 as well...  
> **username_0**: Did craft.matrixBlocks exist on Craft 2?  
> **username_1**: Duh... nope it doesn't.  

---

## 1 answers

### Answer by username_0 on 2017-07-20. Score: 1 | Accepted answer

This was a bug in a beta version of Craft 3 (fixed here: <https://github.com/craftcms/cms/commit/9b6dad7385c5a82d1c83d230fe6ce0cfe940675b>)


---

