Monday, October 15, 2012

Re: Error: Call to a member function find() on a non-object

Here is the error in the error.log:

2012-10-16 01:16:44 Error: Fatal Error (1): Call to a member function find() on a non-object in [C:\wamp\www\cake222\app\Controller\AddressesController.php, line 9]
2012-10-16 01:16:44 Error: [FatalErrorException] Call to a member function find() on a non-object
#0 C:\wamp\www\cake222\lib\Cake\Error\ErrorHandler.php(162): ErrorHandler::handleFatalError(1, 'Call to a membe...', 'C:\wamp\www\cak...', 9)
#1 [internal function]: ErrorHandler::handleError(1, 'Call to a membe...', 'C:\wamp\www\cak...', 9, Array)
#2 C:\wamp\www\cake222\lib\Cake\Core\App.php(926): call_user_func('ErrorHandler::h...', 1, 'Call to a membe...', 'C:\wamp\www\cak...', 9, Array)
#3 C:\wamp\www\cake222\lib\Cake\Core\App.php(899): App::_checkFatalError()
#4 [internal function]: App::shutdown()
#5 {main}





On Monday, October 15, 2012 6:58:52 PM UTC-5, Russell Brown wrote:
Error:  Call to a member function find() on a non-object
File:  c:\wamp\www\cake222\app\Controller\AddressesController.php

I get the error on the $this->set('address_list', $this->Address->find('all')) line below:

Partial listing of my AddressesController file:

<?php
class AddressesController extends AppController {
  var $name = 'addresses';
  
 function index($id = null) {
    $this->set('address_list', $this->Address->find('all'));
  }

I have a controller called AddressesController.php.  I have a Model called Address.php.  The table is called addresses.

I am using Cake 2.2.2 and PHP 5.3.8 and Apache 2.2.21 and MySQL 5.5.16

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: