Hi again.

I have been able to get my ERRest app to create new objects, and with a to-one 
relationship based on the example app.  I note that apparently ERRest (maybe 
rest in general) does not allow you to add an object to a to-many relationship 
directly.  Apparently you need to first GET the intervening object, or create 
one if it doesn't exist, then add the object to it from the other side.  e.g. 
with Organization ->> Member, you'd have to get or create the organization, 
then add the member to it.

What I want to do is create an Action method that allows me to look for an 
existing intervening object based on an attribute, and if one doesn't exist, 
then create one.  Then set that intervening object's relationships back to 
original object and the pointed to object.

So:

I have an entity:  Device which has a to-many to another entity NoteType (which 
in turn has a to-many back to Device)
There is an intervening entity DeviceNoteType which has a to-one to Device and 
another to NoteType

So in my DeviceController, I want to have an Action method updateNoteTypes and 
perhaps another addToNoteTypes

I see in the wiki that this needs to be done in the two steps mentioned above, 
but I don't want to require the calling app to do that, but rather do it myself 
(e.g. passing in json with a name:"myNoteType") and be able to have my method 
do the necessary fetching and setting.  

Whenever I try to do this, I get null as the value from routeObjectForKey.  
Actually, I was getting that anyway, until I called the entity method in the 
controller (e.g. the device() method in the DeviceController class, then I can 
access the keys from that device.  But that doesn't help here.  I looked at the 
example app and do see any to-manys in there, and I've gone through the 
screencast from WO-NoVA multiple times.  I'm just not seeing it.

Any insight would be appreciated.

Andrew
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to