The $modelClass is only created when you do not define the $uses.

On Apr 20, 8:45 am, Leonid Mamchenkov <[email protected]> wrote:
> Hi,
>
> On Tue, Apr 20, 2010 at 18:04, jharris <[email protected]> wrote:
>
> > Since you're using multiple models in your controller (the $uses var),
> > I think Cake is just getting confused. On construct, it probably pulls
> > the model name from the controller name (like how you used
> > Inflector::singularize()) before it loads models. Then, in the actions
> > it probably pulls the first model in the $uses array because the
> > models have been loaded. In this case, Log.
>
> OK, thanks.  That's exactly what I ended up doing.  Added a method to
> app_controller.php which looks like this:
>
>    function getModelClass() {
>         return Inflector::singularize($this->name);
>     }
>
> Works like a charm. :)
>
> > I would recommend against the $uses array unless absolutely necessary.
> > Use App::import() to bring it in, or ClassRegistry::init() to load it
> > when needed. Or bind the Log model to your Ship one, if appropriate.
>
> Is there somewhere I can read more on about this?  I've been following
> 'The Book' so far.
>
> --
> Leonid Mamchenkovhttp://mamchenkov.net
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to