I think the main model has to be first. Have a look at
Controller::constructClasses(). Specifically, this line:

$modelClassName = $uses[0];

On Tue, Jun 23, 2009 at 8:44 AM, DavidH<djhollingwo...@gmail.com> wrote:
>
> Hi
>
> What's the convention for specifying additional models in the
> controller $uses variable?
>
> I have a controller, DashboardsController, that needs to access the
> KpiLevel and KpiColour models as well as the Dashboard model. So my
> controller starts:
>
> class DashboardsController extends AppController {
>
>        var $name = 'Dashboards';
>        var $helpers = array('Html', 'Form');
>        var $components = array('Auth');
>    var $uses = array('Dashboard', 'KpiLevel', 'KpiColour');
>
> .....
> }
>
> Which works fine. However until a few minutes ago my $uses was set to:
>
> var $uses = array('KpiLevel', 'Dashboard', 'KpiColour');
>
> Then when I called my index method:
>
>        function index() {
>                $this->Dashboard->recursive = 0;
>                $this->set('dashboards', $this->paginate());
>        }
>
> the $dashboards in my view was missing all of the dashboard
> information, it only had the related information.
>
> So there appears to be some significance in the order of the models in
> the $uses statement; but I can't find it documented anywhere.
>
> Thanks
>
> David
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to