HI,

I just ran into the same problem and I'm not sure if its a bug or if
the model is just not loaded until after the beforeFilter() function
call.  Nevertheless you can work around the issue as follows:

var $uses = array('Bookstore');

    function beforeFilter()
    {
        loadModel('Bookstore');
        $bookstore = new Bookstore();
        $this->set('newbookstores', $bookstore->findall());
    }

-
thax

On Apr 25, 6:18 am, Mike Williams <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm very new to CakePHP and am having a problem.
>
> I need to provide a list of new stores from my database and make that
> list accessible to all pages.
>
> I copied the app_controller.php file into my /app directory and added
> the following to the code:
>
> var $uses = array('Bookstore');
>
>     function beforeFilter()
>     {
>         $this->set('newbookstores', $this->Bookstore->findall());
>     }
>
> When I run this I get the following error messages:
>
> Notice: Undefined property: PagesController::$Bookstore in /app/
> app_controller.php on line 47
>
> Fatal error: Call to a member function findall() on a non-object in /
> app/app_controller.php on line 47
>
> Here is my model file:
>
> <?php
> class Bookstore extends AppModel
> {
>  var $name = 'Bookstore';}
>
> ?>
>
> The table name in the database is called bookstores.
>
> I've looked through previous posts but can't seem to find an answer.
> It may be that I need to use a component?


--~--~---------~--~----~------------~-------~--~----~
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