Beforeaction() Or Actions() Methods Not Perform

I have 1.1.13 Yii




<?php


class CompanyController extends Controller {


    protected function beforeAction(CAction $action) {

        $current_menu   = Yii::app()->controller->getId();

        $base_url       = Yii::app()->request->baseUrl;

        $menus          = Menus::getMainMenu();

        $sub_menus      = array();


        foreach($menus as $menu_content) {

            if(stripos($menu_content['url'][0], $current_menu)) {

                $sub_menus = $menu_content['items'];

            }

        }


        $this->render($action->id, array(

            'menus'         => $menus,

            'sub_menus'     => $sub_menus,

            'base_url'      => $base_url,

            'action'        => $action->id,

            'current_menu'  => $current_menu

        ));

    }


    public function actionOverview() {

        // nothing to do

    }

    public function actionManagement() {


    }

    public function actionIndex() {


    }


    public function actions() {

        $a = 1;

        return array(

            'board-of-directors' => 'application.controller.company.BoardOfDirectors',

        );

    }


    public function missingAction($action) {

        $b = 1;

    }

}



This is my company controller. Also I have action, which has dashes in name (board-of-directors). That is why I want to realize action() method to invoke another action method to this action, but I receive error, which is in view file. :blink: so actions() do not call.

Also the another strange thing is that beforeAction() do not call, until I do not realize empty action method, like I already have (e.g actionManagement()). Help me guys to understand this strange behavior. Thanks in advance.

It looks like a bad design, why don’t to call the render in each action?

I understand that the code looks repetitive, but this is a controller, it has been thought to be repetitive.

If I may advice you, try to stick on the yii style (the style of the basic controllers), it will be much easier.