CakePHP call to member function on non-object

Posted by joec on Stack Overflow See other posts from Stack Overflow or by joec
Published on 2010-04-12T11:13:32Z Indexed on 2010/04/12 11:23 UTC
Read the original article Hit count: 278

Filed under:

I have the following Model and Controller files, and when i visit this url, http://....../pois/index i get this error:

Notice (8): Undefined property: PoisController::$Poi [APP/controllers/pois_controller.php, line 5]

Fatal error: Call to a member function find() on a non-object in /home/joecoyle/public_html/app/controllers/pois_controller.php on line 5

The Model is this, called poi.php:

<?php
class Poi extends AppModel {

}
?>

And the controller is this, named pois_controller.php

<?php
class PoisController extends AppController {

    function index(){
            $this->set('pois',$this->Poi->find('all'));
    }
}
?>

As i am new to CakePHP i am not sure what is causing this error, as everything seems to be named, right, and i am following the tutorial on the CakePHP site...

Thanks

© Stack Overflow or respective owner

Related posts about cakephp