For the avoidance of doubt, this should read: 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 BEFORE 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 > On 19 Oct 2015, at 15:32, Mark Wardle <[email protected]> wrote: > > 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 > > — > Mark Wardle > [email protected] <mailto:[email protected]>
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
