Are your controller missing the $uses definition, with which you tell
the controller, that it should use a model?
See the CakePHP book at:
http://book.cakephp.org/view/53/components-helpers-and-uses

[code]
   var $uses => array('Battle');
[/code]

Enjoy,
   John

On Feb 21, 5:40 pm, Thau <[email protected]> wrote:
> Hi,
> I created a Controller called battles_controller.php and a model
> called battle.php.
> There is a function in the model called GetStats. I tried to call this
> function with:
> $this->Battle->GetStats(); I got error:
>
> Notice (8): Undefined property:  BattlesController::$Battle [APP/
> controllers/battles_controller.php, line 12]
> Code
>
>         if(!$this->Session->check('battle'))
>         {
>             $Character    = $this->Battle->GetStats();
>
> BattlesController::beforeFilter() - APP/controllers/
> battles_controller.php, line 12
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 186
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 170
> [main] - APP/webroot/index.php, line 83
>
> Fatal error: Call to a member function GetStats() on a non-object in
> ***/app/controllers/battles_controller.php on line 12
>
> Have I done something wrong or why is there this error?

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