you can add some model by importing those .
At the top you can add

App::import('Model','ModelName');

now in the execute() function

$object=new Model()
$object->find('all') ;

now it will work .




On Nov 11, 3:46 am, Crazy <[email protected]> wrote:
> I'm using a task in one of my cake shell classes. I want to use some
> models there but $uses doesn't seem to work.
>
> There is no 'initialize' method, and even if I add it and call the
> parent, it still doesn't seem to do the trick.
>
> Anything I'm missing?
>
> This is what I'm doing:
>
> class MyTask extends Shell {
>     var $uses = array('MyModel');
>
>     function execute() {
>         var_dump($this->MyModel->find('all'));
>     }
>
> }
>
> gives me an "Fatal error: Call to a member function find()  on a non-
> object"

--

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=.


Reply via email to