How get content in afterExecuteRoute method?

I need save content in memcached. How get volt rendered content in afterExecuteRoute method?

Like this perhaps:

public functin afterExecuteRoute(Event $event, Dispatcher $dispatcher)
{
    $content = $dispatcher->getReturnedValue()->getContent();
}


10.8k

Fatal error: Call to a member function getContent()

Wojciech Ślawski, you use phalcon 2+?

edited Aug '16

Yes. What you return in controller action ? Not response ? It should work if you return:

return $responset->setContent('xyz');

Or you use automatic rendering, or return $this->view->pick() or return $this->view->render()

What exactly $dispatcher->getReturnedValue() return ?

If this is not working then try:

$content = $dispatcher->getDI()->get('response')->getContent();