Flexible forms and supporting database structure

Posted by sunwukung on Stack Overflow See other posts from Stack Overflow or by sunwukung
Published on 2011-01-04T22:47:11Z Indexed on 2011/01/04 22:53 UTC
Read the original article Hit count: 200

Filed under:
|
|

I have been tasked with creating an application that allows administrators to alter the content of the user input form (i.e. add arbitrary fields) - the contents of which get stored in a database. Think Modx/Wordpress/Expression Engine template variables.

The approach I've been looking at is implementing concrete tables where the specification is consistent (i.e. user profiles, user content etc) and some generic field data tables (i.e. text, boolean) to store non-specific values. Forms (and model fields) would be generated by first querying the tables and retrieving the relevant columns - although I've yet to think about how I would setup validation.

I've taken a look at this problem, and it seems to be indicating an EAV type approach - which, from my brief research - looks like it could be a greater burden than the blessings it's flexibility would bring.

I've read a couple of posts here, however, which suggest this is a dangerous route:

How to design a generic database whose layout may change over time?

Dynamic Database Schema

I'd appreciate some advice on this matter if anyone has some to give

regards

SWK

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql