I'm by no means an expert so somebody may want to disagree here, but I
think if you are not bothering with templates, I would have one
"documents" table, with all of the possible relevant fields. You could
possibly break it up if you wanted to, and break up the information in
seperate tables and link it in with relations, but I don't think in
this instance there would be any point. The only reason you break up
tables is if you would run out of fields (e.g. you created 10 comment
fields, what happens when you need 11 kind of thing if that makes
sense?) But as you are specifying everything it should be OK to have
one.

Hope that helps and I haven't confused you!

On May 23, 3:03 pm, byqsri <marco.rizze...@gmail.com> wrote:
> Ok many thanks that's is clear
> I have another question
> Do I keep the values of the fields of all documents in a single table?
> a table like this:
>
> document_id, document_field_id, value
>
> I ask this question
> Because in 'value' I can have a number ,a string, a text ,a datetime
> I don't know if it's the best
>
> On 23 Mag, 15:49, number9 <xpozit...@gmail.com> wrote:
>
>
>
> > If I've understood you correctly.... each document will have a number
> > of different fields that would be useful to store in the database, but
> > all documents are unique.
>
> > The first thing I would do is write down a list of every single
> > possible field that you would need for these documents. If you think
> > that some documents will share certain characteristics, you could make
> > another table and have a few document templates that would fit your
> > needs. E.g. one template has text, title and attachment, another is
> > the same but does without the attachment.
>
> > Alternatively you could just create one big table with all of the
> > possible fields that you drew up and just make them optional.
> > Obviously you would need some form of validation. You could set them
> > as NULL in your mysql database (so they allow empty values), then draw
> > up a validation rule that said documents must have at least 3 fields
> > (for example).
>
> > On May 23, 1:24 pm, "marco.rizze...@gmail.com"
>
> > <marco.rizze...@gmail.com> wrote:
> > > Hi
> > > My problem is about the project of the models of my web application
> > > I have a model Document . The problem is that this model must have
> > > dinamic data fields.
> > > A document can have like fields : title .text , data
> > > Another can have : title, number , attachment
> > > ect...
> > > This fields can have different type: some can be simple string, other
> > > can be file , other can be text .
>
> > > Substantially for the moment I have create only the model Document but
> > > I've no idea how to handle everything else
> > > I really hope that someone can help me
> > > 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to