Tuesday, July 24, 2012

Re: Can I / should I create multiple models for same single table?

You can create another model with the same table

Start here http://book.cakephp.org/2.0/en/models/model-attributes.html

HTH
Tarique

On Wed, Jul 25, 2012 at 7:38 AM, Kevin Mitchell <kevin@ncbible.com> wrote:
> Hi ... and thank you so much for your time and expertise:
>
> I've made a lot of progress learning CakePHP, but I cannot find in the
> documentation what I should do when I want another, second model based upong
> the same database table.
>
> I have a single table, called topics. I've created one version of "Topics"
> model in one app that uses the standard approach and a second version of
> "Topics" model, in a second, separate app, that uses public $actsAs =
> array('Tree'); to create a TreeBehavior model. In each case I've called the
> model Topics, using the naming convention that matches the model to the
> table name.
>
> But what if I sometimes want to use the first version of the model and
> sometimes the second version of the model -- both in the same app? I tried
> naming the TreeBehavior version of the model "Tree" and then using public
> $useTable = 'Topic'; -- but I couldn't get things to work.
>
> I'm just wondering what, probably basic, concept I'm missing.
>
> Again, thank you!
>
> Kevin
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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



--
=============================================================
PHP for E-Biz: http://sanisoft.com
=============================================================

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

No comments: