-
Notifications
You must be signed in to change notification settings - Fork 638
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]: When removing money entry from entry type data stays saved as string #12539
Comments
Hi, thanks for reaching out. In terms of the values still being there after removing the field from an entry type - this is the expected behaviour at this point: #12069 (comment). I have created a PR to make the Also, just in case you find it helpful, you can still check for an entry type in an overview template. You can use |
@i-just a few remarks.
In my opinion there is still something fundamentally wrong either way or another. You couldn't expect people to go into the database and clear all values to make it work / have the money filter fail silently on places where it shouldn't be used. |
On the above notes @brandonkelly , just an idea: Would it be possible whenever a field is parsed -- entry type is known, fieldLayouts are linked already to it, is to check if the field is actually still part of the entry type's fieldLayout, if it's not known to the fieldLayout of said entry type anymore, twig should not parse it and throw an error "field is unknown" rather than actually show content. This could be an in between in the discussion if content should be removed from the database or not. The content could still stay in the database, it's just the value that wouldn't be parsed anymore and treated as "unknown property" |
This is resolved for the next Craft 3 and 4 releases, via #12578. |
Craft 3.7.64 and 4.3.7 have been released with that fix. |
I think this fix introduces a new bug: It seems to me that Craft now no longer eager loads matrix blocks. Due to the filter applied here all matrix blocks are removed from the array |
Ah just left a comment b687738 but yeah, as @sebastian-lenz says, eager loading is broken. |
Hi, thanks for reporting and the details. Much appreciated! A new PR to fix this issue has been created. |
This still isn't fixed for me in 4.3.8... |
@boboldehampsink Can you elaborate? |
In my case this:
Used to work before 4.3.7, and doesn't work on 4.3.8 |
@boboldehampsink Sorry, that was my fault (bad merge). 4.3.8.1 is out now with a proper fix. |
Note that if you updated to 4.3.8 via the control panel, you will be affected by this bug, which was also fixed in 4.3.8.1. If so you will need to run |
Works now, thanks! |
Thanks for confirming! :) |
Since installing 4.3.8 I'm getting lots of other eagerloading related errors, see https://robuust-6t.sentry.io/share/issue/b17a72d652334f53a4ecba27f89d99d2/ |
Same here. Getting the same error pretty much everywhere :( |
4.3.8.1 fixes some eagerloading issues and is causing others for us. We're gonna stay on 4.3.6.1 till this stabilizes. Re-reading this issue and wondering if maybe the money filter should just be a little more flexible? Seems like different solutions that update eagerloading logic are causing lots of unintended consequences. |
Like maybe if the money filter accepted Or maybe the element should return null if that field isn't in the field layout anymore, instead of whatever is in the content table. It does seem kinda weird that you can remove a field from an entry type, and still get a value. |
What happened?
Description
When a money field has existed on multiple entry types, but is later removed from an entry type. The field value stays in the database content table. This value is now handled as string, which throws an error applying the
|money
filter.Steps to reproduce
Expected behavior
When a money field is removed from an entry type, also remove all associated data of the money field in the database, so we can generate an overview without throwing any error. Or keep the data in the database but don't parse the field as it's disassociated with the field layout.
Actual behavior
When adding
entry.moneyField
to loop over all entries (without checking the entry types, e.g. for an overview) the entry types that used to have a money field are now throwing the following error:Craft CMS version
4.3.6.1
PHP version
8.0
Additional info
Trying to find a workaround is a bit bulky, using the resave command for bulk editing isn't a solution since the field doesn't exist anymore. The only solution is to add/create the field again to the entry type. Save everything with
:empty:
deploy, do this on staging / production, to remove the field again and deploy again. This is quite cumbersome.The text was updated successfully, but these errors were encountered: