Hi

Basically, I want to build a distributable application, and one of the
most important feature is
Dynamic configurable profile fields/columns by Admin user (the
application customer)

Let say
site XXX is about business, so the site owner (Admin) would probably
config user profile fields to have
first name, last name, company, position etc..

site YYY is about college, so the site owner (Admin) would probably
config user profile fields to have
first name, last name, school, degree, major etc..

Of course, at anytime, the Admin can add or remove those profile
fields, without losing data.

However, Propel/Doctrine require you to pre-build the model from given
schema with fields ready.

HERE ARE MY THOUGHTS SO FAR
----------
using Guard ..

Table: User
id:
profile_id:

SOLUTION 1
-----
Table: FieldMap
id:
name: field name/title (first name, last name etc..)
type: field type (char, number, date etc..)
etc.. for extra options

Example data:
1, First Name, char
2, Last Name, char
3, Year, number
...

Table: ProfileValue
id:
profile_id: ref profile id
fieldmap_id: ref FieldMap
value: actual value of the field for that profile

Example Data:
id,profile_id,fieldmap_id,value
1, 1, 1, Jack
2, 1, 2, Lee
3, 1, 3, 1990
4, 2, 1, Danis
5, 2, 2, Bush
6, 2, 3, 1978
etc..

This solution does NOT require you to rebuild the model or anything,
so it's cool.

HOWEVER, it would create alot of problem and complexity in searching
for profiles, like find all profiles start with "B", living in XXX,
between year A,B etc..
As well as enforcing the data type for the profile field value, ie
distinguish between INT, CHAR, TEXT, DATE etc..
We have to use "BLOB" for it (the column "value" of table
ProfileValue)


SOLUTION 2
----------------
Table: FieldMap
id:
name: field name/title (first name, last name etc..)
type: field type (char, number, date etc..)
etc.. for extra options

Table: Profile
id:

This would be initial schema, when the application is distributed.
Because no profile fields have been config/setup by site owner/Admin
yet.

So when the Admin config his site by adding/remove fields, it would
add entry to FieldMap and alter Profile table columns

Let say, Admin want to add "First Name" field to profile, it would do

1) Add record "First Name, char" to "FieldMap" table
2) Add column "first_name" with type "char" to "Profile" table

So profile table would be like this
Profile:
id:
first_name: (type char)

This solution work very nice for searching and query, however the
generated classes do NOT know about the "existent" of first name, last
name etc.. because they were not there when the initial application
was distribute.

So what your thoughts on this?

Thanks

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to