CakePHP doesn't support this kind of behaviour out of the box, but it
is definitely possible to set it up.
I recently prototyped something like this for an experimental CMS
where in Node::__construct() I would have (in pseudocode)
if $this is not Node
bind desendant to Node
bind Node to decendant
To initialise it just required something like [class Page extends
Node]. Then all the Node callbacks (save/delete/find) could be taken
care of by the parent class itself.
It also seems possible to move this logic into a behaviour, but I
think it is more flexible keeping it in a parent model class.
On Aug 8, 3:45 pm, welja <[email protected]> wrote:
> Can CakePHP support Class Table Inheritance?
> (http://martinfowler.com/eaaCatalog/classTableInheritance.html)
>
> In other words, can a cakephp Model set and get it's data from
> multiple tables.
>
> A short example, consider the following tables:
> * node
> - id
> - name
> - class
> - price
> - (more metadata)
>
> * node_tv
> - id
> - display_size
>
> * node_computer
> - id
> - processor_type
> - harddisk_size
>
> When you instantiate a new Computer Model, cakephp should set / pull
> (preferably via a smart query) it's data from the tables node and
> node_computer.
>
> This way all metadata is kept in the node table, which is easy for
> looking up general product info fast and - with a large number of
> products - keeps the metainfo maintainable.
>
> I use this design pattern often in my custom build apps and i wonder
> if cakePHP is able to do something similar, without performance loss
> (aka smart queries).
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---