Hi,

I have an "interesting" problem here - in a given mysql database
scheme some sql wizard used comma-separated values in a text-field and
with that values lookups have to be done. The data itself is simple
numbers like 1,34,25,66,78,134 and so on. So what I have is something
like this:

id | username | groups         | more...
---------------------------------------------
1 | name        | 1,23,4,55,6  | ...
2 | name2      | 3,2,4,5        | ...

The groups string can be very long. there is also a table "groups"
with "id, name", as expected.

Yes, this is bad design. No, I can not immediately change the design,
I will try to, but atm I have to handle the situation as it is.

Of course normally this would be solved with an intersection table and
a many-to-many relation. For anybody interested: there is a book by
Bill Karwin called "SQL Antipatterns" - he names the described design
Jaywalking and it is the first antipattern in the book. I was
surprised to find it in real life....

So my question is: how to handle this with cakephp? I really would
like to use cake to bake a nice management interface on top of that
tables, but currently I do not know how to go on with that jaywalking
antipattern in my way.

My first idea was to create my own intersection table - but the
process of [re-]converting data forth and back does only work in a
static environment - but the data is heavily used and so
transformations of tabledata would be neccassery on every request to
mirror the live situation... so I am looking for a good way to
implement some kind of layer that would translate this filed for
cakephp into an intersaection table so that I can use cake models -
maybe a kind of datasource? Will this work?

What do you think? How to handle this?

Thank you very much for your attention!
Snaky

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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/cake-php?hl=en

Reply via email to