Re: is there a trick to know that a property of EO did change?

2020-05-24 Thread Michael Sharp via Webobjects-dev
ERXGenericRecord.changesFromCommittedSnapshot

if (changesFromCommittedSnapshot().containsKey(MY_KEY)) {
  propertyDidChange(MY_KEY);
}

As mentioned by Aaron this could be wedged into overridden setters, 
validate methods or even worked into your eogen template if you 
wanted this behaviour model wide.

It might also be worth looking at the audit trail implementation in 
ERCoreBusinessLogic for ideas on a configurable observer/notifier.

Sharpy.



> On 25 May 2020, at 10:40 am, ocs--- via Webobjects-dev 
>  wrote:
> 
> Hi there,
> 
> I'd need to get a notification whenever a property of my EO changes, be it 
> directly through a setter, or through an inverse-relationship being 
> maintained, or through an object of an M:N deleted, whatever way. Something 
> like
> 
> class MyEO extends ERXGenericRecord {
>  void propertyDidChange(String key) {
>... to be called just after any property of mine changes, with its key ...
>  }
> }
> 
> Does EOF or WOnder provide something like that? Whatever I try, I can't find 
> it. I could easily observe willChanges of course, but that's something rather 
> different...
> 
> Thanks,
> OC
> 
> ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/getsharp%40gmail.com
> 
> This email sent to getsh...@gmail.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: is there a trick to know that a property of EO did change?

2020-05-24 Thread Aaron Rosenzweig via Webobjects-dev
Hi OC,

Could you override the setter of that property?

If it was “firstName” could you create “setFirstName()” which calls super and 
then does the additional logic you desire?
AARON ROSENZWEIG / Chat 'n Bike 
e:  aa...@chatnbike.com   t:  (301) 956-2319



> On May 24, 2020, at 8:40 PM, ocs--- via Webobjects-dev 
>  wrote:
> 
> Hi there,
> 
> I'd need to get a notification whenever a property of my EO changes, be it 
> directly through a setter, or through an inverse-relationship being 
> maintained, or through an object of an M:N deleted, whatever way. Something 
> like
> 
> class MyEO extends ERXGenericRecord {
>  void propertyDidChange(String key) {
>... to be called just after any property of mine changes, with its key ...
>  }
> }
> 
> Does EOF or WOnder provide something like that? Whatever I try, I can't find 
> it. I could easily observe willChanges of course, but that's something rather 
> different...
> 
> Thanks,
> OC
> 
> ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/aaron%40chatnbike.com
> 
> This email sent to aa...@chatnbike.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


is there a trick to know that a property of EO did change?

2020-05-24 Thread ocs--- via Webobjects-dev
Hi there,

I'd need to get a notification whenever a property of my EO changes, be it 
directly through a setter, or through an inverse-relationship being maintained, 
or through an object of an M:N deleted, whatever way. Something like

class MyEO extends ERXGenericRecord {
  void propertyDidChange(String key) {
... to be called just after any property of mine changes, with its key ...
  }
}

Does EOF or WOnder provide something like that? Whatever I try, I can't find 
it. I could easily observe willChanges of course, but that's something rather 
different...

Thanks,
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com