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

[4.x] In Craft 5, a nested entry whose entry type has since been deleted from Craft throws an error on the back-end and the front-end #191

Closed
gregorydavidjenkins opened this issue Mar 12, 2024 · 2 comments
Assignees
Labels

Comments

@gregorydavidjenkins
Copy link

gregorydavidjenkins commented Mar 12, 2024

Description

Deleting an entry type that is already being used inside of a ckeditor field throws an error when you go back and try to edit the entry that has that ckeditor field. I suppose some graceful failing of the nested entry (not existing, or other things going wrong) is needed here.

Steps to reproduce

  1. Create an entry type (X)
  2. Create a ckeditor field which is allowed to create entries of that type
  3. Add that field to a field layout for an entry type (Y)
  4. Create an entry (A) of type Y which has that ckeditor field in it's layout.
  5. Use the ckeditor to Create an entry (B) of type X nested inside of the ckeditor content.
  6. (So far so good)
  7. Delete entry type X (the whole entry type, not the entry)
  8. Trying to edit that entry (A) results in an error (below).
  9. Visiting the entry's URL on the front-end results in the same error.

Additional info

  • Craft version: 5.0.0-beta.5
  • PHP version: 8.2.16
  • Database driver & version: MySQL 8.0.32
  • Plugins & versions: CKEditor | 4.0.0-beta.7

Error

craft\elements\Entry::getType(): Return value must be of type craft\models\EntryType, null returned

@brandonkelly
Copy link
Member

Thanks for reporting that! It’s now fixed in 4.0.1. You’ll also need to be on Craft 5.0.0-beta.8 or later for the fix to fully work.

@gregorydavidjenkins
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants