I've designed databases like this several times in the past. Specifically
for CRM solutions where the users can add global custom fields or even add
custom fields for specific contact records. I think it is a good solution.
I have in fact started a sfDoctrineCrm plugin where you build your own data
structures from a GUI and select the widget type of each field. Then when
you edit a contact it dynamically builds the form.
- Jon
On Mon, Nov 17, 2008 at 11:25 AM, Richtermeister <[EMAIL PROTECTED]> wrote:
>
> Hey James,
>
> I've used something like that in the past (was even
> internationalized), and the way I did it is that I added a type field
> to the attribute table, so that attributes became "text", "longtext",
> "boolean", "select one", "select many", etc...
>
> That way you can generate appropriate input elements and output
> formatting for each attribute.
>
> Also, double check the phpName for your first table.. looks like you
> used sfSimpleUserProfileAttributeCategory twice.
>
> Let me know if this is of any help.
> Daniel
>
>
>
> On Nov 16, 7:20 pm, James <[EMAIL PROTECTED]> wrote:
> > I am working on a user profile plugin that I am planning on releasing
> > to the community once it's one, I am looking for some advice on how to
> > approach something.
> >
> > In the past I have worked on ecommerce systems that have had product
> > attributes, and each attribute was mapped to a list of values, then
> > each product mapped to an attribute/value pair. I was thinking about
> > taking the same approach. The problem is I want to allow some free
> > form values for some attributes and not for others. I am not sure
> > the correct way to approach it. here's what my schema looks like now,
> > I am looking for some advice as to how to approache the 2 kinds of
> > attributes.
> >
> > Thoughts?
> > James
> >
> > sf_simple_user_profile_member:
> > _attributes: { phpName:
> > sfSimpleUserProfileAttributeCategory }
> > id:
> > enabled_status: { type: boolean, default: false }
> > created_at:
> > updated_at:
> >
> > sf_simple_user_profile_attribute_category:
> > _attributes: { phpName:
> > sfSimpleUserProfileAttributeCategory }
> > id:
> > name: { type: varchar(255) }
> > created_at:
> > updated_at:
> >
> > sf_simple_user_profile_attribute_name:
> > _attributes: { phpName:
> > sfSimpleUserProfileAttributeName }
> > id:
> > name: { type: varchar(64) }
> > enabled_status: { type: boolean, default: false }
> > sort_order: { type: integer, default:
> > 0 }
> > created_at:
> > updated_at:
> >
> > sf_simple_user_profile_attribute_value:
> > _attributes: { phpName:
> > sfSimpleUserProfileAttributeValue }
> > id:
> > name: { type: varchar(64) }
> > sort_order: { type: integer, default:
> > 0 }
> > created_at:
> > updated_at:
> >
> > sf_simple_user_profile_attribute_category_name_map:
> > _attributes: { phpName:
> > sfSimpleUserProfileAttributeCategoryNameMap }
> > id:
> > attribute_category_id: { type: integer,
> > foreignTable: sf_simple_user_profile_attribute_category,
> > foreignReference: id }
> > attribute_name_id: { type: integer,
> > foreignTable: sf_simple_user_profile_attribute_name, foreignReference:
> > id }
> > created_at:
> > updated_at:
> >
> > sf_simple_user_profile_attribute_name_value_map:
> > _attributes: { phpName:
> > sfSimpleUserProfileAttributeNameValueMap }
> > id:
> > attribute_name_id: { type: integer,
> > foreignTable: sf_simple_user_profile_attribute_name, foreignReference:
> > id }
> > attribute_value_id: { type: integer,
> > foreignTable: sf_simple_user_profile_attribute_value,
> > foreignReference: id }
> > created_at:
> > updated_at:
> >
> > sf_simple_user_profile_attribute_member_name_value_map:
> > _attributes: { phpName:
> > sfSimpleUserProfileAttributeMemberNameValueMap }
> > id:
> > profile_id: { type: integer,
> > foreignTable: sf_simple_user_profile_member, foreignReference: id }
> > attribute_name_id: { type: integer,
> > foreignTable: sf_simple_user_profile_attribute_name, foreignReference:
> > id }
> > attribute_value_id: { type: integer,
> > foreignTable: sf_simple_user_profile_attribute_value,
> > foreignReference: id }
> > created_at:
> > updated_at:
> >
>
--
Jonathan H. Wage
Open Source Software Developer & Evangelist
http://www.jwage.com
http://www.doctrine-project.org
http://www.symfony-project.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---