View returns NULL on View::getControllerName and View::getActionName

Hello,

I have DI initialized as Phalcon\DI\FactoryDefault().

In controller's action $this->getDI()->getDispatcher()->getControllerName() and $this->getDI()->getDispatcher->getActionName() returns actual controller and action names, but View returns NULL when trying to get it via $this->getDI()->getView()->getControllerName(), $this->getDI()->getView()->getActionName().

This fact makes View unable to render nessesary template. Layout is rendered ok, but <?=$this->getContent();?> in layout file returns nothign :(

Beside that, when I'm using View::pick() - template is rendered ok, but without layout :( So, $this->getDI()->getView()->pick('index/login') is ok, but it is rendered without wrapping layout.

Executing $this->getDI()->getView()->render('index', 'login') renders that page with layout. So, I suppose that the problem is View know nothing about current controller / action. :(

$this->getDI()->getView()->getViewsDir() returns correct path.

$this->getDI()->getView()->getActiveRenderPath() also returns NULL.

Thank you!



4.8k

UPD: I've renamed layout from common to index ($this->getDI()->getView()->setLayout('index')) and now $this->getDI()->getView()->pick('index/login') displays layout ok. Very strange behaviour.