|
Markus,
does this approach properly work for you with saved EOs? Weird; I was pretty sure localinstance would not copy down to the new EO the local changes, IIRC, the new EO in the new EC is simply a GID-based fault, to be, upon using, just re-constructed from the snapshot (which is the reason you can't do that with a new EO which does not have one), and that's that.
Thus, unless I'm much mistaken,
// presumed the saved eo.foo=='old'
eo.foo='new'
assert eo.localInstanceIn(anotherEC).foo=='old'
All the best,
OC
> On 15. 10. 2021, at 14:48, Markus Ruggiero (rucotec) <webobjects-dev@wocommunity.org> wrote:
>
> LocalInstance is only allowed for EOs that have already been saved. If isNewObject() return true then any form of localinstance call returns an exception. Why? And how can I overcome this?
>
> I have the following scenario:
>
> The user picks existing EOs to be worked on at a later point in time. They can also create on-the-fly new EOs for picking. All EOs as well as the new ones are associated with the current editing context. The whole list of picked objects (NSArray containing existing and new EOs) is then passed to the next page and on to the next. In each step some of the EOs are modified in various ways until about 3 steps down the line a final saveChanges() is done. All fine so far.
>
> But on each step the user can go back up one step (either browser back button or with a dedicated navigation button on the page). The page cache takes care of this but the EOs themselves are not in the page cache and remain modified in their EC. Coming back the previous / first page does not show the initial state anymore. Ok, easy to solve (methinks): map the EOs into a new editing context right before going to the next step. Coming back then automatically throws away that EC. Going forward again will create a brand new EC. But! localInstancing into the new EC only works for saved EOs. How do I get these new EOs into the nextPhaseEC? The new EOs are fairly complex and already have relationships to other EOs. How can I re-wire the new EOs?
>
> Thanks for any help
> ---markus---
>
|
|