Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
error using
  • hi , i got the following error using after
    ErrorException [ Runtime Notice ]: Declaration of Controller_Base::after() should be compatible with that of Fuel\Core\Controller_Template::after()
    here is my code
    http://scrp.at/aNn
  • As is often the case: the error message tells you exactly the problem: your after() method isn't compatible with the one in the core it's extending. If you were to look into your log files you'd probably see a more descriptive error as well that was generated by Fuel. As of v1.1 the after() method must take and return the controller's $response, check out te changelog for more info.
  • I couldn't figure it out straight away, but I believe this is correct:
    function after($response)
    {
        parent::after($response);
    }
    
  • You don't have to call the parent method, but you do have to return the response (which you're not doing in that example). The parent method is just this (and thus unnecessary to call):
    public function after($response)
     {
      return $response;
     }
    
  • Ah so unless you've got a chain of them, then you can just return the response?
  • Right, the after() method is meant to allow you to do some generic post-processing to the controller output.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion