-
Notifications
You must be signed in to change notification settings - Fork 820
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
BUG Fix writeBaseRecord with unique indexes #8831
BUG Fix writeBaseRecord with unique indexes #8831
Conversation
Interestingly this bug has been around as long as SilverStripe has. https://github.com/silverstripe/silverstripe-framework/blob/2.1/core/model/DataObject.php#L432-L436 |
be7b229
to
d1396b7
Compare
Oops, prepareManipulationTable assumed ID was set. A small tweak fixed that. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
Nice one @tractorcow! 🎉 |
I'm guessing in the example above It's more of a point on succinct semantics and reducing tech debt/legacy. Maybe a comment can be introduced here, like: // Ensure we have an ID first and then synchronize ID's across child object records.
if ($this->isInDB()) {
$manipulation[$table]['id'] = $this->record['ID'];
} Or similar. I've proposed an explanation of an API level disambiguation on that nuance in #8411 (comment) |
I would write something like |
@tractorcow the kitchen sink found some bugs that this introduced, I've made a tiny patch at #8839 to fix that |
@tractorcow ignore me, actually some dodgy logic in the auditor module |
Fixes #6819
I've had this bug in mind for years. This will fix the below bug once and for all:
This often came up when writing ChangesetItem due to the primary key being a composite on a couple of columns.