protected function createCtrl()
    {
        $oView              = ViewFactory::createView(
            $this->ctrlName,
            str_replace('action', '', $this->actionName)
        );
        $aComponentsRootMap = AppHelper::getInstance()->getConfig('componentsRootMap');
        if (!isset($aComponentsRootMap['controllers'])) {
            throw new Exception("The field 'componentsRootMap.controllers' must be "
            ."presented in the main configuration file.");
        }
        $sCtrlNamespace = str_replace(
            \DIRECTORY_SEPARATOR,
            '\\',
            $aComponentsRootMap['controllers']
        );
        $sCtrlNameFull  = $sCtrlNamespace.'\\'.$this->ctrlName;
        if (!is_null($oView)) {
            $sLayoutName = AppHelper::getInstance()->getConfig('defaultLayout');
            if (!is_null($sLayoutName)) {
                $oLayout = ViewFactory::createLayout($sLayoutName, $oView);
                $oCtrl   = new $sCtrlNameFull($this->request, $oLayout);
            } else {
                $oCtrl = new $sCtrlNameFull($this->request, $oView);
            }
        } else {
            $oCtrl = new $sCtrlNameFull($this->request);
        }
        return $oCtrl;
    }
protected function createCtrl()
    {
        $oView              = ViewFactory::createView(
            $this->ctrlName,
            str_replace('action', '', $this->actionName)
        );
        $aComponentsRootMap = AppHelper::getInstance()->getConfig('componentsRootMap');
        if (!isset($aComponentsRootMap['controllers'])) {
            throw new Exception("The field 'componentsRootMap.controllers' must be "
            ."presented in the main configuration file.");
        }
        $sCtrlNamespace = str_replace(
            \DIRECTORY_SEPARATOR,
            '\\',
            $aComponentsRootMap['controllers']
        );
        $sCtrlNameFull  = $sCtrlNamespace.'\\'.$this->ctrlName;
        if (!is_null($oView)) {
            $sLayoutName = AppHelper::getInstance()->getConfig('defaultLayout');
            if (!is_null($sLayoutName)) {
                $oLayout = ViewFactory::createLayout($sLayoutName, $oView);
                $oCtrl   = new $sCtrlNameFull($this->request, $oLayout);
            } else {
                $oCtrl = new $sCtrlNameFull($this->request, $oView);
            }
        } else {
            $oCtrl = new $sCtrlNameFull($this->request);
        }
        return $oCtrl;
    }
protected function createCtrl ( ) { $ oView = ViewFactory :: createView ( $ this -> ctrlName , str_replace ( 'action' , '' , $ this -> actionName ) ) ; $ aComponentsRootMap = AppHelper :: getInstance ( ) -> getConfig ( 'componentsRootMap' ) ; if ( ! isset ( $ aComponentsRootMap [ 'controllers' ] ) ) { throw new Exception ( "The field 'componentsRootMap.controllers' must be " . "presented in the main configuration file." ) ; } $ sCtrlNamespace = str_replace ( \ DIRECTORY_SEPARATOR , '\\' , $ aComponentsRootMap [ 'controllers' ] ) ; $ sCtrlNameFull = $ sCtrlNamespace . '\\' . $ this -> ctrlName ; if ( ! is_null ( $ oView ) ) { $ sLayoutName = AppHelper :: getInstance ( ) -> getConfig ( 'defaultLayout' ) ; if ( ! is_null ( $ sLayoutName ) ) { $ oLayout = ViewFactory :: createLayout ( $ sLayoutName , $ oView ) ; $ oCtrl = new $ sCtrlNameFull ( $ this -> request , $ oLayout ) ; } else { $ oCtrl = new $ sCtrlNameFull ( $ this -> request , $ oView ) ; } } else { $ oCtrl = new $ sCtrlNameFull ( $ this -> request ) ; } return $ oCtrl ; }
It creates the controller object, assignes it with default view and layout
objects.
@return \nadir\core\AWebController.
It creates the controller object assignes it with default view and layout objects .