Wednesday, October 16, 2013

Re: __construct causing error in AppController

Because you've missing params for __construct() method :)
Try to:

    public function __construct($request = null, $response = null)
    {
        parent::__construct($request, $response);

//        Write to here...
    }

I used and successfully!

On Wednesday, August 26, 2009 2:53:17 AM UTC+7, Benjamin Moses Lieb wrote:
My new AppController is empty, and I added an empty __construct () to
add some info for all my controllers

<?php
class AppController extends Controller {

        function __construct () {
        }
}
?>

However the addition of the __construct() function causes this error:

Fatal error: Call to a member function init() on a non-object in /
apppath/cake/libs/controller/controller.php on line 442

--
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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: