Re: Can't get automatic inverse relationships to work
Re: Can't get automatic inverse relationships to work
- Subject: Re: Can't get automatic inverse relationships to work
- From: Anjo Krank <email@hidden>
- Date: Thu, 9 Oct 2008 10:28:02 +0200
Uh... the whole point of the inverse relationship updating was that
you could say setAvatar() or addToAvatars() and if would update the
reverse for you? Since when is the code below needed now? I'd never
want a method that calls itself "setFooRelationship" as an extra to
setFoo().
Cheers, Anjo
Am 08.10.2008 um 18:58 schrieb Mike Schrag:
Are you using the newer wonder eogen file that talks about automatic
inverse updating?
Your underscore file for a to-one should look roughly like:
public er.attachment.model.ERAttachment avatar() {
return
(er.attachment.model.ERAttachment)storedValueForKey("avatar");
}
public void setAvatar(er.attachment.model.ERAttachment value) {
takeStoredValueForKey(value, "avatar");
}
public void setAvatarRelationship(er.attachment.model.ERAttachment
value) {
if (_Person.LOG.isDebugEnabled()) {
_Person.LOG.debug("updating avatar from " + avatar() + " to " +
value);
}
if
(er
.extensions
.eof
.ERXGenericRecord
.InverseRelationshipUpdater.updateInverseRelationships()) {
setAvatar(value);
}
else if (value == null) {
er.attachment.model.ERAttachment oldValue = avatar();
if (oldValue != null) {
removeObjectFromBothSidesOfRelationshipWithKey(oldValue,
"avatar");
}
} else {
addObjectToBothSidesOfRelationshipWithKey(value, "avatar");
}
}
On Oct 8, 2008, at 12:35 PM, Fredrik Lindgren wrote:
I use all this in my app:
extend ERXApplication
extend ERXSession
extend ERXGenericRecord
use ERXEC.newEditingContext()
In properties i do this:
er.extensions.ERXEC.safeLocking=true
er.extensions.ERXEnterpriseObject.updateInverseRelationships=true
When a set a one relationship from a form (without using the
setXXXRelationship) the relationship does not update on the other
side!
When using the setXXXRelationship it all works.
Am I missing something?
Regards
/Fredrik
_________________________________________________________________
drop, Kålsängsgränd 10 B, 753 19 UPPSALA, Sweden
_______________________________________________
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
_______________________________________________
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
_______________________________________________
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