Re: Making changes to EO after validation?
Re: Making changes to EO after validation?
- Subject: Re: Making changes to EO after validation?
- From: Greg <email@hidden>
- Date: Fri, 13 May 2005 12:58:23 +1000
I though PWO said that it is not advised, but if you _have_ to, use
the takeValueForKey instead of the actual accessor. page 146 "Forcing
Invalid Values"
Greg
On 13/05/2005, at 12:29 PM, Stirling Olson wrote:
Thanks Mark. Yeah, what I'm really trying to do is to make the
change only after I know that ALL validations will pass and the EO
will be saved.
-Stirling
On May 12, 2005, at 8:24 PM, Mark Edwards wrote:
You can make changes to the EO's individual properties in it's
corresponding validateKey methods.
Refer:
http://developer.apple.com/documentation/WebObjects/
Enterprise_Objects/BusinessLogic/chapter_4_section_4.html#//
apple_ref/doc/uid/TP30001011-DontLinkChapterID_3-TPXREF141
Regards,
Mark
On 13 May 2005, at 11:59, Stirling Olson wrote:
Hi,
I would like to make a change to an EO just AFTER it has
validated but just BEFORE it has saved to the graph/DB. Is this
possible?
It appears an update goes something like this (I'm using Wonder):
willUpdate() -> validateForUpdate() -> validateForSave() -> SAVE -
> didUpdate()
What I really want is something like didValidate() which would
happen just before the SAVE. Any ideas?
To let you know what I'm trying to accomplish here:
I have Shift and CashBox EOs. When I try to close out a Shift
and Shift.endingCashBoxBalance != CashBox.balance the validation
fails UNLESS a discrepancy note has been added to the Shift EO.
What I would like to do is to update the CashBox.balance but ONLY
after all other validations have occurred and have been
successful. This allows for me to keep the "old" CashBox.balance
until all other validation problems have been cleared up. I can
trick this behavior in the components by saving twice (i.e.
updating CashBox.balance and then doing a second saveChanges() if
the first succeeded) but what I'm trying to do seems to me like a
business logic problem and therefore I'd like to put it in my EOs
and not in the apps themselves. FYI: CashBox is related to Shift
through Shift.cashBox().
I can't make changes to the EOs in validateForUpdate() or
validateForSave() according to Practical WebObjects, right? Any
other ideas other than the above suggestions in each and every
component which deals with this issue?
Thanks!
-Stirling
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40framedphotographics.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden