Wednesday, February 25, 2009

Re: Ordered list of arbitrary objects

One approach you may wish to take is to do the subclassing in the
database itself.

First, have a superclass table which contains the common attributes
shared among all the subclasses, along with the normal primary key
'id' attribute. Then create a table for each subclass that has a
primary key (in addition to subclass-specific attributes of course)
that points to a record in the superclass table. With all of that set
up, you can then order the superclass table. The are two additional
things you have to do when using this method. One is that you would
have to ensure the specialization constraint (disjoint or overlap) for
the subclasses isn't violated. The second is that the superclass's
type of participation (total or partial) in the specialization should
be enforced.

There are several ways to do this sort of thing strictly in the
database, but the aforementioned way is usually the recommended
solution.
--~--~---------~--~----~------------~-------~--~----~
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: