Tom Hallman
2004-02-25 18:06:08 UTC
Hi all,
Here's a situation I have, and I'm trying to figure out how best to do it
using Modeling.
I have a Person entity, and it has a ToMany relationship with BankAccount
entities. One of the attributes of BankAccount is "isDefault", which is 1 if
the particular account is (duh) the default one, and 0 otherwise.
So part of the validation logic for validateIsDefault(), I figure, should
make all other BankAccounts' isDefaults set to 0 if this new account is set
to 1.
The problem is that I'd like to get at the editing context which is
calling validateIsDefault in the first place, so that changing the other
isDefaults to 0 would *only* happen if the entire new account gets correctly
saved. (In other words, the ec I create in this function, I think, should be
a nested ec of the calling ec.)
Is there a way to do this? Or am I going about this in the wrong way?
Thanks for any insight!
~Tom
___________________________________________________________
Tom Hallman DiscipleMakers, Inc
***@dm.org http://www.dm.org/~hallmant
531 Brittany Dr * State College * PA * 16803 * 814-861-4591
Go therefore and make disciples of all nations (Matt 28:19)
Here's a situation I have, and I'm trying to figure out how best to do it
using Modeling.
I have a Person entity, and it has a ToMany relationship with BankAccount
entities. One of the attributes of BankAccount is "isDefault", which is 1 if
the particular account is (duh) the default one, and 0 otherwise.
So part of the validation logic for validateIsDefault(), I figure, should
make all other BankAccounts' isDefaults set to 0 if this new account is set
to 1.
The problem is that I'd like to get at the editing context which is
calling validateIsDefault in the first place, so that changing the other
isDefaults to 0 would *only* happen if the entire new account gets correctly
saved. (In other words, the ec I create in this function, I think, should be
a nested ec of the calling ec.)
Is there a way to do this? Or am I going about this in the wrong way?
Thanks for any insight!
~Tom
___________________________________________________________
Tom Hallman DiscipleMakers, Inc
***@dm.org http://www.dm.org/~hallmant
531 Brittany Dr * State College * PA * 16803 * 814-861-4591
Go therefore and make disciples of all nations (Matt 28:19)