Re: Exception Handler Not Getting $this and by extension $this->request

2011-10-17 Thread majna
You should place any custom exception renderers in app/Lib/Error
and configure like this:

Configure::write('Exception', array(
'handler' => 'ErrorHandler::handleException',
'renderer' => 'AppExceptionRenderer',
'log' => true
));


2011/10/17 zuha 

> Here's some code in case anyone can help decipher why the error is
> happening.
>
> Following instructions here :
> http://book.cakephp.org/2.0/en/development/exceptions.html#built-in-exceptions
>
> // in /app/Config/core.php
> #Configure::write('Exception', array(
> # 'handler' => 'ErrorHandler::handleException',
> # 'renderer' => 'ExceptionRenderer',
> # 'log' => true
> #));
> Configure::write('Exception.renderer', 'AppExceptionRenderer');
>
> // in /app/Lib/AppExceptionRenderer.php
>
> App::uses('ExceptionRenderer', 'Error');
>
> class AppExceptionRenderer extends ExceptionRenderer {
>  public function missingController($error) {
> echo 'Oops that widget is missing!';
> }
>
>
> And this is the error printed on the page when visiting the root (ie.
> http://localhost)
>
>
>  ( ! ) Fatal error: Uncaught exception 'MissingControllerException' with
> message 'Controller class Controller could not be found.' in
> C:\wamp\www\zuha\lib\Cake\Routing\Dispatcher.php on line *83* ( ! 
> )MissingControllerException: Controller class Controller could not be found.
> in C:\wamp\www\zuha\lib\Cake\Routing\Dispatcher.php on line *83*
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Exception Handler Not Getting $this and by extension $this->request

2011-10-17 Thread zuha
Here's some code in case anyone can help decipher why the error is 
happening. 

Following instructions here 
: http://book.cakephp.org/2.0/en/development/exceptions.html#built-in-exceptions

// in /app/Config/core.php 
#Configure::write('Exception', array(
# 'handler' => 'ErrorHandler::handleException',
# 'renderer' => 'ExceptionRenderer',
# 'log' => true
#));
Configure::write('Exception.renderer', 'AppExceptionRenderer');

// in /app/Lib/AppExceptionRenderer.php

App::uses('ExceptionRenderer', 'Error');

class AppExceptionRenderer extends ExceptionRenderer {
 public function missingController($error) {
echo 'Oops that widget is missing!';
}


And this is the error printed on the page when visiting the root (ie. 
http://localhost)


 ( ! ) Fatal error: Uncaught exception 'MissingControllerException' with 
message 'Controller class Controller could not be found.' in 
C:\wamp\www\zuha\lib\Cake\Routing\Dispatcher.php on line *83* ( ! 
)MissingControllerException: Controller class Controller could not be found. 
in C:\wamp\www\zuha\lib\Cake\Routing\Dispatcher.php on line *83*

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Exception Handler Not Getting $this and by extension $this->request

2011-10-17 Thread majna
You are in static context, 
http://www.php.net/manual/en/language.oop5.basic.php

Put AppExceptionRenderer.php in app/Lib/Error/ folder.

You are welcome to contribute to Docs https://github.com/cakephp/docs

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Exception Handler Not Getting $this and by extension $this->request

2011-10-17 Thread zuha
Its not that $this->sendEmail() is a bad example.  I was only using that as 
an example of how $this->[anything] is not working.   Including 
$this->request->url or if I add another function underneath that function 
and do 

public static function handle($error) { 
$this->functionInTheSameClass(); 
}

Really the whole thing is just not working as expected when I do exactly 
what is in the documentation.   Like when I do the AppExceptionRenderer 
thing in the book, the AppExceptionRenderer.php file is never found in the 
/app/Lib/  directory, and I get nothing but uncaught exception errors. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Exception Handler Not Getting $this and by extension $this->request

2011-10-17 Thread majna
$this->sendEmail(); is bad example and should be fixed in docs. Remove this 
line
and use CakeEmail class to send emails.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Exception Handler Not Getting $this and by extension $this->request

2011-10-17 Thread zuha
I followed the documentation exactly in the book, specifically 
 
(http://book.cakephp.org/2.0/en/development/exceptions.html#built-in-exceptions)...

getMessage();
   $this->sendEmail();
}
...
}


And it gives you this error : Fatal error: Using $this when not in object 
context in C:\wamp\www\zuha\app\Lib\AppExceptionHandler.php on line *9*

This is causing other problems too, in that I think its stopping the 
application from finding AppExceptionRenderer (explained in the same book 
page).   

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php