You can certainly create multiple models for one table and you should if
you want to have several different behaviors, like in your case. It is
quite possible that your "Tree" does not work because of a name clash or
you made a mistake somwhere in naming the class, file or something else. I
would recommend giving it a longer name, like "TopicsTree" and
double-checking all names. CakePHP has a lot of magic that breaks too
easily if you misname something.
Cheers!
Albert
On Wednesday, July 25, 2012 4:08:28 AM UTC+2, Kevin Mitchell 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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php