Yii Framework Forum: How is generated the id for nested modules? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How is generated the id for nested modules? Rate Topic: -----

#1 User is offline   codatavern 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 22-May 09
  • Location:Spain

Posted 20 July 2012 - 03:24 AM

Hi everyone, i have an admin interface built with yii, using nested modules.

The main structure at the config file would be:



'modules' => array(
        'admin' => array(
            'modules' => array(
                'countries',
                'states',
                'cities',
                'profiles',   			
                'banners'
            )
        ),      
    ),



Every module extends from AdminModule, having the following init() function:


public function init() {
        $idd = str_replace('/','.',$this->id);   	
        
        $this->setImport(array(
            "{$idd}.models.*",
            "{$idd}.components.*",            
        ));
                        		
        $this->setComponents(array(
            'errorHandler' => array(
                'errorAction' => "admin/default/error"),
            'user' => array(
                'class' => 'CWebUser', 			
                'loginUrl' => Yii::app()->createUrl("admin/default/login"),
                'allowAutoLogin' => true,
            ),            
        ));                
                
        Yii::app()->user->setStateKeyPrefix("_admin");            	
    } 



Here comes the problem... For some reason i want to load a particular model within BannerModule, but, import doesn't work, because the ID generated for the model is the following "adminadmin/banners" instead of "admin/banners". I don't know how ID is generated and I know i could make a specific init() function for the BannerModule, but my intention is not to make that, so this way the code stays cleaner.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users