Models are only auto-loaded inside controllers, not components.

You can manually load a model, or pass one in from the controller.

App::import('Model','Counter');
$this->Counter = new Counter();

Cheers,
Adam

Miguel wrote:
> Hi all,
>
> I'm starting with Cake 1.2. I'm very happy with cake.
>
> In my little application, I'm adding a counter in one action. To do
> this, I have written a CounterComponent. Here is the code:
>
> class CounterComponent extends Object
> {
>     var $disableStartup = false;
>       var $uses = array('Counter');
>
>       function startup(&$controller)  {
>         $Counter = new Counter;
>       }
>
>     function updateCounters() {
>               $counters = $this->Counter->findAll();
>               ...
>       }
> }
>
> But, i have a "Class Counter not found" in the startup. And of course
> I have a Counter in the models.
>
> Any suggestion?
>
> Thanks a lot:
>
> Miki
--~--~---------~--~----~------------~-------~--~----~
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