scott lewis wrote:
> This far from an ideal solution, but it might be workable...
>
> Schema:
>          runs
>          id    INT
>          exec_id       INT
>          ...
>
>          execs
>          id    INT
>
>          exec_type1s
>          id    INT
>          exec_id       INT
>          ...
>
>          exec_type2s
>          id    INT
>          exec_id       INT
>          ...

Hmm, that's an approach I hadn't considered, having the id's of the
parent in the child.

>
> Models:
>          Run
>                  belongs_to      Exec
>
>          Exec
>                  has_many        Run
>                  has_one         ExecType1, ExecType2
>
>          ExecType1
>                  belongs_to      Exec
>
>          ExecType2
>                  belongs_to      Exec
>
>
> In OO terms, Exec becomes an 'Abstract Base Class' of sorts. If you
> want all Execs, Exec->findAll, if you want all Type 1 Execs,
> ExecType1->findAll. The only tricky bit is to remember to always use
> "/execs/show/{$the_record['Exec']['id'}". And when you have an array
> of Execs, you can infer the type from the fact that only one of
> $the_record['ExecType1'] and $the_record['ExecType2'] will be non-empty.

I think that what you're doing is moving a bit of what I was doing (in
the controller) to the model and using Cake's relationships to help.

> hth,

Certainly given me food for thought.

I was resigning myself to having single level inheritance by merging
the ExecType1 and ExecType2 fields and then having a switch field of
sorts to define what type it was.

Thanks,

Allan


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to