I are doing a project where we our client runs ~15 competitions each
year, but the application form the user is required to fill out for
each form vary in the exact fields/questions they ask. And of course,
they run these same competitions year-after-year, but often add or
remove a custom field or two.

About half of the fields across all applications are common (Name,
Email, Address, Phone, etc.) but they also ask different questions on
each form that vary from simple integer values, to boolean (yes/no)
values, to several paragraphs of freeform text.

So I created a basic Application model, then am using Doctrine's
column-aggregate inheritance to create each concrete Application
class. Here's my abbreviated schema:

Application:
  actAs:
    KeyValueStore: ~
  columns:
    id:
      type: integer
      primary: true
      autoincrement: true
    full_name:
      type: string(255)
    email:
      type: string(255)
    office_address:
      type: string(255)
    home_address:
      type: string(255)
    telephone:
      type: string(25)

IronManApplication2011:
  inheritance:
    extends: Application
    type: column_aggregation
    keyField: object_type
    keyValue: iron_man2011

So I came across Tom Boutell/P'unk Ave's plugin
sfDoctrineActAsKeyValueStorePlugin. It allows you to persist any
number of varying key => value pairs with your Doctrine object. It
serializes the various key/value pairs and throws them into a blob
field. Perfect! I can create my base Application form and create a
concrete form for each custom Application object.

Since I never ORDER BY or query against these values, I figure this
approach will work for me. This isn't a high performant site, so a
slight hit during serialization/unserialization will be OK.

You can read more about the plugin here:
http://trac.apostrophenow.org/wiki/sfDoctrineActAsKeyValueStorePlugin

Now has anyone used this plugin and taken form fields and stored them
as the key/value pairs? It would be great if the form fields could
auto-save onto the object, and auto-repopulate the form fields when
passing the object into the form constructor. I feel like there will
be some form save() overriding in my future?

Thanks to anyone who has any ideas!

John Kary

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@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