Thursday, September 18, 2008

Model with varying fields? can Cake help in some way?

Hi,
I thought I'd ask for any advice in this direction. I am not looking
for a quick fix. More like gotchas and good ideas when going in this
direction. If anyone recognizes what I am rambling about, please nudge
me in the right direction, or show me a rubberized room if that is
more appropriate.
I think I will need a model that ideally should work much like a
normal model but the available fields will change and be very
"dynamic". That is the data will be imported Excel files (or other
structured data) where one may have different "fields" from the
second. I would still like to be able to somehow search and sort these
"records".

Man, this is hard to explain in english. It could be explained as a
kind of database for storing a database in @:)

OK, try this:
If I have a normal table called users (id, uname, pass, email), Cake
can give me the schema and I can "scaffold" a form containing these
fields. If I change the schema in the database I can get the new
fields automatically. Now take that one step further and say each user
may have different properties.

So thought (not really complete tables):
I will create a table called users (id)
AND a table called fields (id, name, type, user_id)
AND a table called records (id, data, field_id, user_id)

Maybe not exactly like that but you get the idea. Tables modeling the
structure of a "virtual" table. So when I do a find on my User model I
want to try to query for in the records table and return the users
that have records that match some criteria. Complex searches are not
the first priority. That would be actually safely storing this kind of
imported data in a good way.

OK, still with me? Sound at all similar? Sounds crazy? Got any ideas?
Please let me know .

Martin


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: