Feature/clean up join messups#73
Merged
DarkSide666 merged 57 commits intodevelopfrom Jul 25, 2016
Merged
Conversation
Because cloned models are not very reliable now.
Applied fixes from StyleCI
Applied fixes from StyleCI
Applied fixes from StyleCI
Applied fixes from StyleCI
$m->save() invokes update with a fixed ID. Also it updates joined tables separately. Because the record has been loaded successfully before and will be reloaded after updates (in some cases) at a risk of failed transaction, we don't have to invoke action here. Action is more suited for all-set update and if you use joins with SQLite you're on your own, as it does not support join with update. Same goes for deletion.
This reverts commit 77733ae.
If model is saving field and join is saving on top, we get problem.
No manual tweaking of related values (until we can figure out how to do it safely, through join)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge #72 and #71 first.
Then pull from "master".
Fixing duplicates in the same field
The recent PR into DSQL atk4/dsql#100 has introduced a side effect. atk4/dsql#102 adds a check resulting in exception when the following is called:
As it turns out SQL Join would execute set() when 'foo' is joined field:
Also if the field is defined as-is then used in a join, it would cause a similar mess-up. This PR fixes that.
Unloading and changing Join
Another problem was visible if you change the field in the "join" field then load a different record. Join wouldn't reset the changed field and would slap that new value into an unrelated record.
Now when the record is unloaded, join-items are cleaned properly.
Change in joined field only.
Previously when you change no field and call save() it would do nothing. If you only change the field that is join() and call save() it would still do nothing.
Now steps are taken to make sure the joined table is updated correctly.