views:

246

answers:

1

I had been wondering why my error page caused certain pages of my site not to render, but then I realized that it's because AppError extends ErrorHandler instead of AppController. This caused some variables that I set in AppController's beforeFilter method not to be sent to the view. Since I can't access session variables from AppError, I thought that I might be able to get away with using the classRegistry to instantiate something that could and simply copying and pasting the rest of my code from AppController's beforeFilter... but that isn't working, nor does it seem like a very elegant fix. Does anyone have any clues as to what would be the best way to approach this? Thanks, David.

+3  A: 

Your AppError class has a controller instance. You can call the beforeFilter manually:

<?php
class AppError extends ErrorHandler {
  function error404() {
    $this->controller->beforeFilter();
    parent::error404();
  }
}
?>
Matt Curry
Thank you so much! I have literally been on google forever...
David