SOLVED: problem with willInsert() and willUpdate() when using D2W.
SOLVED: problem with willInsert() and willUpdate() when using D2W.
- Subject: SOLVED: problem with willInsert() and willUpdate() when using D2W.
- From: Mark Wardle <email@hidden>
- Date: Mon, 19 Oct 2015 15:32:47 +0100
Dear all,
I thought I would share a tricky problem and its solution.
I have implemented willInsert() and willUpdate() and used them successfully. Oddly, they didn’t seem to get called during the editing or creation of a new entity and so I was getting validation errors.
It sounds simple now but the D2W edit page checks a D2W key called shouldValidateBeforeSave which means that validateForInsert() or validateForSave() is called BEFORE willInsert or willUpdate. The documentation for ERXEnterpriseObject of course suggests that willInsert/willUpdate will be called AFTER validation. Simply setting D2W key shouldValidateBeforeSave to false resolves the issue.
Therefore, if you are using D2W and you have odd willInsert or willUpdate errors, then check here. The source code for ERD2WInspectPage shows this clearly enough although I can’t work out why anyone would want to explicitly call validate before save given that validation should occur before saving simply during saveChanges().
Best wishes,
Mark
|
_______________________________________________
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