Hi, here's my sample code.
Notice this line: $view->setViewsDir( $this->getViewDirectory( ) );
class Index extends \Phalcon\Mvc\User\Component Implements IndexInterface {
protected $_id;
protected $_name;
protected $_type;
protected $_path;
protected $_directory;
public function initialize ( ) {
}
public function registerAutoloaders ( ) {
}
public function registerServices ( $di ) {
$di->set( 'view_simple', function ( ) use ( $di, $config ) {
$view = new \Application\Libraries\Engine\View\ViewSimple( );
$view->setViewsDir( $this->getViewDirectory( ) );
get_class($this); // Phalcon 2.0.X it returns the Index Classs, Phalcon 3.0.0 returns DI
$view->registerEngines( array(
'.volt' => function ( $view, \Phalcon\DiInterface $di ) use ( $config ) {
$volt = new \Phalcon\Mvc\View\Engine\Volt( $view, $di );
$volt->setOptions( array(
'compiledPath' => $config->builds->path,
'compiledExtension' => $config->builds->extension,
'compiledSeparator' => '_',
'compiledAlways' => $config->builds->always
));
return $volt;
},
'.phtml' => '\Phalcon\Mvc\View\Engine\Php'
));
return $view;
});
}
public function getViewDirectory ( ) {
return ....
}
}
How can i still access the Index class instead of the DI?
Imagine if i extended the class Index and the getViewDirectory method is returning differrent values.