Hi All,

On 18 abr, 10:06, GreyCells <[EMAIL PROTECTED]> wrote:
> Hi Laptop
>
> Cake uses the active record model, so by convention, expects  a one to
> one relationship between model and table. That said, it is possible
> for multiple models to share the same table by specifying the useTable
> attribute. If you're developing with 1.2, the actsAs could prove an
> alternative to multiple levels of inheritance. (i.e.
> OnlineAdvertisement actsAs Advertisement), although I must confess I
> have not use actsAs in anger yet...

Good idea IMO. And wouldn't be difficult to achieve, just 'injecting'
Model.type_field = 'a type' to all the find and creation queries. The
soft delete behavoir described on the bakery is almost the same
principle.

>
> For models that share mostly the same attributes, a few redundant
> columns in your table is a small price compared to the ease of
> maintenance and that niggling overhead of an extra join. From the
> information you've given, I'd probably treat the Online and/or Print
> as attributes of an Advertisement rather than seperate models. This is
> a bit like vi vs emacs - despite what many will tell you, there is no
> 'right way' from a pure design perspective - hence the multitude of
> ORM tools/projects out there. Just pick the simplest route first and
> refactor if it doesn't work out :)
>
> @gwoo: Are there any technical reasons why PrintAdvertisement cannot
> extend Advertisement? (i.e. framework complications rather that app
> complications).

I've done that before, and (as you would expect) so long as the class
you want to extend is already loaded (either explicitly by your own
code, or because it's loaded first by cake) cake wouldn't know or need
to know there was a class in the middle.

Cheers,

AD


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to