You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have seen this once or twice in support – there are elements in the elements table where type is set to craft\models\EntryDraft rather than craft\elements\Entry. It’s not really clear how it happens though.
You can resolve by executing the following SQL query:
UPDATE elements SET type ='craft\elements\Entry'WHERE type ='craft\models\EntryDraft'
Thank you for your reply @brandonkelly, this does indeed solve the error. For others, please note you need to escape \ and the tables are usually prefixed with craft_, resulting in:
UPDATE craft_elements SET type ='craft\\elements\\Entry'WHERE type ='craft\\models\\EntryDraft'
Jerome is right about needing to escpape the \ characters. Although for anyone else who comes here - tables are generally only prefixed with craft_ if it used to be a Craft CMS 2 website - mine was just called elements.
What happened?
Description
After upgrading to Craft 4, some entries in multiple client projects throw a BadRequestHttpException when editing the entry through the CP:
2022-08-23 09:44:35 [web.ERROR] [yii\web\HttpException:400] craft\models\EntryDraft doesn’t exist or doesn’t extend/implement craft\base\ElementInterface
Craft CMS version
4.2.1.1
PHP version
8.1.2
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: