Re: Creating related objects and multiple ECs
Re: Creating related objects and multiple ECs
- Subject: Re: Creating related objects and multiple ECs
- From: Chuck Hill <email@hidden>
- Date: Tue, 16 Feb 2010 13:41:48 -0800
On Feb 16, 2010, at 1:32 PM, David LeBer wrote:
This is something I've run into multiple times, hacked something to
work, and then thought there must be a better way.
The scenario:
------------------
I have Studio <studio*----------movies>> Movie
If I create a new Studio, I will use a generic Studio edit form to
set it's values, the form has a button that allows the user to add a
new related Movie.
Here's the conundrum:
------------------------------
- If I use the same EC for the Movie, and the user cancels in the
Movie's Edit form, the EC will get reverted (bad).
- If I use a nested EC for the Movie, I cannot build a relationship
between it and the Studio (because they are in different ecs), I
cannot call local instance on the Studio because it hasn't been
committed yet,
Does that not work? I thought it did as the parent is the child's OSC
so it can get the object copied into it.
Chuck
and I cannot call local instance on the Movie until after it's ec
has been saved, which will unfortunately throw a validation error
(because it's Studio relationship is required in the model).
Things I've done in the past:
-------------------------------------
- Disable adding Movies to a Studio until the Studio has been
committed (then local instance will work).
- Modify the model so that the to-one relationship from Movie ->
Studio is not mandatory, and hide the to-one edit widget in the
Movie form for newly minted Movies, and then set the relationship
between the two AFTER the Movie has been successfully saved and we
are heading back to the Studio form.
When rolling my own edit forms, this not so much of an issue, but in
D2W where everything is generic it bites, I hate having to write
custom rules and modify the model to work around this.
Anyone have an magical solution that I am missing?
;david
--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site: http://codeferous.com
blog: http://davidleber.net
profile: http://www.linkedin.com/in/davidleber
twitter: http://twitter.com/rebeld
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org
_______________________________________________
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
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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