Hmm, so here's the situation I'm seeing. Personalization ->> Image
Phase 1: I remove an Image and add new one. Phase 2 (later down the line, but within the same OC): I decide that I don't want to make those changes to the original Personalization, but rather in a new one...so I duplicate the Personalization and its Images (as it currently is), and then want to reset the original Personalization back to it's saved state. So I call invalidateobjects on the Images and then the Personalization created in Phase 1. This will save, but it will still execute the original delete of the Image in Phase 1 and the insert of the new Image from Phase 1. So I end up modifying the objects from Phase 1, even though from an object perspective they are in the correct state. The OC never knew to undo its delete/insert, so those proceed anyway. Thoughts? -Lon On Sun, Oct 18, 2020 at 12:12 AM Andrus Adamchik <[email protected]> wrote: > "invalidateObjects" should invalidate relationships too. IIRC this worked > exactly as you'd expect in a root context. I don't use nested contexts. > Wonder if a bug crept in there? > > Andrus > > > > On Oct 18, 2020, at 2:53 AM, Lon Varscsak <[email protected]> > wrote: > > > > I have a situation where I need to invalidate an object and have it go > > back to it's committed state (whether that's from the db or a parent > > context). If I invalidate the object, it's attributes seem to do what > I'm > > expecting, but it appears that it leaves relationships alone. I need a > way > > to invalidate all of it's relationships, restore those objects back to > > their committed state (maybe they've been deleted or modified...as well > as > > get rid of any newly created objects). How would I accomplish this? A > > child context doesn't work in my case...because the user has already > > "saved" to the parent...it's that a later behavior triggers them to say, > > nah, never mind...I want the original object back. > > > > Note: I'm pretty sure in EOF I just called invalidate objects on the main > > object and everything else was taken care of...not positive though. > > > > Thanks in advance for the help! > > > > -Lon > >
