-
Notifications
You must be signed in to change notification settings - Fork 683
Open
Description
What happened?
Description
The logic at the following line checks if the $item is an instance of EntryType:
cms/src/elements/db/EntryQuery.php
Line 428 in b5f17cd
| return $item instanceof EntryType ? $item->id : null; |
However the getEntryTypesByHandle method returns an array so it can never be true, resulting in typeId always being queried from the database:
cms/src/elements/db/EntryQuery.php
Line 426 in b5f17cd
| $item = Craft::$app->getSections()->getEntryTypesByHandle($item); |
Steps to reproduce
- Run the following code (two queries for the same type twice in succession).
$query = Entry::find();
Craft::configure($query, ['type' => 'myTypeHandle']);
$query = Entry::find();
Craft::configure($query, ['type' => 'myTypeHandle']);Expected behavior
Type is resolved from Memoized array from the Sections service.
Actual behavior
Type is always queried from the database.
Craft CMS version
4.16.15
PHP version
8.3.22
Operating system and version
No response
Database type and version
No response
Image driver and version
No response