Posted by Dave on 06/22/07 17:00
I have multiple forms that will create an object. Basically a energy
efficiency measure object. The measure object will have a couple of
required properties set but after that it can have 10-20 different fields
that are optional per measure.
How do I account for the different fields that will be
posted from the different forms when I create the measure object? Should
I create a constructor method with just the required fields as the
parameters and then create some sort of setter method for the optional
fields? Or do I create a different concrete measure object from an an
abstract measure base class? I have about 10 different measure objects
that I can think of but really the only difference between them are what
optional fields are posted.
Going forward the other issue is I need these measures to persist across
the pages of the application (sort of like a shopping cart app) and I see
that I can serialize an object in a $_SESSION object but do the fields
that I would set in the setter method also get serialized or do only the
actual properties of the object get set.
I then need to retrieve all these measure objects and send them to a
stored procedure to enter into a database so unfortunately I can't save
the fields as serialized because each field has to be separate to be sent
as the parameters to the stored procedure.
Basically my question is how do people deal with huge forms and fields
easily from a html post? Any help would be appreciated...thanks...
P.S. Using ZendFramework1.0RC2 and PHP5.
[Back to original message]
|