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
[Data Objects] Save default values to versions #10087
[Data Objects] Save default values to versions #10087
Conversation
This reverts commit 0dd1ed1.
…-values-to-versions
Are the failing tests caused by this PR? I don't think so but am not sure |
@BlackbitNeueMedien failing tests seem to be related, base branch runs through without any issues. |
@BlackbitNeueMedien I guess a unit test would definitely make sense here. wdyt 😉 |
@BlackbitNeueMedien This needs to be done for fieldcollections, bricks & blocks as well. |
Added test, added support for localized fields, object bricks, field collections. |
@weisswurstkanone For the test I wanted to add an input field with a default value. How does this work? Obviously it is not enough to add it to the definition file in https://github.com/pimcore/pimcore/pull/10087/files#diff-07e12400f01e9028add55e187301705004f356fbc4a4c23ce29b2113a31d88e9R572 But CI complains about |
@BlackbitNeueMedien you have to add a datachild with name |
Thanks Divesh. @BlackbitNeueMedien just for clarification: The classes are generated by code. The json files are just generated for your convenience. |
@BlackbitNeueMedien what is the status regarding the tests ? 🤔 |
The status is that I currently do not know why the tests fail. If you have some time to support, this would be great. |
I am on it! Thx! |
Hello @BlackbitNeueMedien , regarding the test. I believe it should be
so lblockadvancedRelations instead of blockmanyToManyRelations. |
@BlackbitNeueMedien I'll close this PR since you're separating them anyway, right 😊 Looking forward to the 2 PRs. |
@brusch No. Please reopen it. I just remove the ValidationException things from this PR here and put those changes into another one. |
@BlackbitNeueMedien sure, no problem 😊 |
30f1083
to
b9de9f3
Compare
Ok, I reverted all changes related to the ValidationExceptions. This PR is now ready for review |
Sorry, @weisswurstkanone's fix got missing because I am too stupid to use git ;-) |
@BlackbitNeueMedien I wouldn't introduce this change in a bug-fix release, because someone could rely on the current behavior. I think it would be ok to do this in a minor release, but before we gonna merge this PR we should discuss this as well. In the meantime, could you please rebase this PR onto |
…-values-to-versions
Rebased to |
@BlackbitNeueMedien one more minor thing, we should mention the behavior change in the upgrade notes. Thanks! |
@brusch I added documentation in the upgrade notes. |
thanks a lot! |
With #5594 saving field's default value to database was introduced. The problem is that these default values do not get saved to versions currently. This is especially bad because when you publish this version, you will again have
null
in the respective fields.Steps to reproduce:
abc
, default valuetest
test
in columnabc
abc
is emptynull
in the database column -> this is really bad because you can not restore the exact state the object had at this point (what is the main purpose of versioning beside tracking changes)With this PR the default values are also saved to the database (and also to the PHP object being saved - which is important, if you have further operations with it after saving).