I have a slightly odd case I'm trying to figure out:

I have two model classes, defined with the following schema:

Widget:
  columns:
    title:              { type: string, notnull: true }
    description:        { type: string }

FeaturedWidgetStatus:
  actAs:
    Sortable:        ~
  columns:
    widget_id:           { type: integer, notnull: true }
  relations:
    Widget: { onDelete: CASCADE, local: widget_id, foreign: id,
foreignAlias: Featured, foreignType: one }


To explain this schema: Featured Widgets can be sorted amongst
themselves, so rather than just having a boolean "featured" flag on
the Widget model I have the "featuredness" indicated by whether or not
a Widget object has (or has not) an associated FeaturedWidgetStatus
object.

(In reality there are a number of other fields on both of these models
but they aren't relevant for this discussion.)

In my Widget editing form, I want to have a checkbox where the user
can indicate whether the Widget is featured (checkbox is checked) or
not featured (checkbox is not checked).

When the Widget editing form is submitted, I want to take a look at
the submitted checkbox value and if it is unchecked (but the Widget
has an associated FeaturedWidgetStatus), I'll delete the Widget's
associated FeaturedWidgetStatus object.

Conversely, if the submitted checkbox value is checked (but the Widget
does not already have an associated FeaturedWidgetStatus), then I'll
create a new FeaturedWidgetStatus associated with this Widget.

My problems is I'm not sure where to put this logic - where can I see
the value of the checkbox after the form has been submitted?  Where
should I hook into the default form-submission / binding /
object-saving procedure in order to interject this special logic
(creating or deleting the FeaturedWidgetStatus based on the value of
the checkbox)?

Thanks.
-david

-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.

Reply via email to