Monday, May 25, 2009

Problem about data modelling in CAKEPHP

Hi
I have a problem about modelling data of my application and I don't
know how resolve it.
I present my situation:
My E-R is
__________ _____________
| | N /\ M | |
| Document |<--------/ \-------->| DocumentField |
|___ ______| \ / |______________|
\/

Now in the relation HABTM with Document and DocumentField I have the
attribute "value".
The relational mode is:

Document:
id , title , created

DocumentField:
id,name , type( it is the type of the field , It can be a string , a
text , a datetime,a url, a number) , created

The HABTM relation is:
id, document_id , document_field_id , value (the value of the field in
the document)

Now my problem is how manage the attribute "value" in Mysql because
it can be a datetime , a varchar , a longtext.lo
If I have more attribute , every which its type (like value_datetime,
value_text, value_varchar) I have many and many attribute that are
null (every record has a single attribute with value the other are
null).
If I have a single attribute with for example type longtext I have a
very confused and unmanageable situation

Has anyone any suggestions?
I hope someone can help me about this.
Many thanks
--~--~---------~--~----~------------~-------~--~----~
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: