On your Recipe entity class add:

public void addToSteps(Step eo) {
        //Set step value…
        includeObjectIntoPropertyWithKey(eo, "steps");
}

public void removeFromSteps(Step eo) {
        //Update step values…
        excludeObjectFromPropertyWithKey(eo, "steps");
}

Ramsey

On Jul 5, 2012, at 2:14 AM, Amy Worrall wrote:

> I have a Recipe which can have any number of Steps. Each Step can only
> be attached to a single recipe. The Steps have an order, which is
> stored in a stepOrder property on the Step itself.
> 
> I'd like the user to only interact with Steps in the context of a
> Recipe, so I'll make it display the steps as an inline edit
> relationship when editing a Recipe.
> 
> The question is how best to deal with the ordering? Ideally I'd like
> these things to happen:
> 
> * Steps are always numbered within a recipe 1, 2, 3, …
> * The user can't enter step numbers directly. Creating a new step adds
> it to the end of the list with the appropriate number.
> * Step numbers are displayed to the user, as read only.
> * By each step is an "Up" and a "Down" button. Press "Up" and it swaps
> the step in question with the one above it, changing the numbers as
> appropriate.
> * If a step is deleted, all the numbers of the remaining steps shuffle
> up to remain continuous.
> 
> Is there any built in D2W-friendly way to work with an ordering like this?
> 
> Thanks,
> 
> Amy
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/ramseygurley%40gmail.com
> 
> This email sent to [email protected]


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

This email sent to [email protected]

Reply via email to