importing model from other module

I am working on a project in YII. I have planned to develop the site modules based. Everything was working fine but today I created a module and imported it the main module. now, when i go to the site at my localhost the browser displays the The connection was reset page. here is the code

Users Model in /modules/users/models/Users.php

public function relations()







        return array(


            'contacts' => array(self::HAS_MANY, 'UserLeeds', 'user_id'),

            'userNotifications' => array(self::HAS_MANY, 'UserNotifications', 'user_id'),

            'userTasks' => array(self::HAS_MANY, 'UserTasks', 'user_id'),

            'userRole' => array(self::BELONGS_TO, 'Roles', 'user_role'),

            'userCompany' => array(self::BELONGS_TO, 'Company', 'user_company_id'),

            'userClient' => array(self::BELONGS_TO, 'Clients', 'user_client_id'),



Notifications Model in /modules/notifications/models/UserNotifications.php

public function relations()


        // NOTE: you may need to adjust the relation name and the related

        // class name for the relations automatically generated below.

        return array(

            'notificationType' => array(self::BELONGS_TO, 'Notifications', 'notification_type'),

            'user' => array(self::BELONGS_TO, 'Users', 'user_id'),



If in the Users Model I comment out the


line all works fine.

Any idea what I am missing here.


Well, just found that if I comment out any of the imported modules it works fine then…

does this mean YII limits the import of module/models to other module/modle to only 4?


Why are you importing models inside the rules method?

Thanks for the reply mdomba :)

I want to develop site with multiple clients.

I divided all major features in modules like notifications, tasks and etc so that I can enable / disable them depending on the client logged in.

The said module in this question is Users that is a default to all clients. I need to get data from all allowed modules for a client for that I was trying to import the corresponding model from other modules like

for notifications => Notifications.php from notifications module

for tasks => Tasks.php from tasks module

for events => Events.php from events module

and etc

all was working fine but the issue I found is that I am unable to import more than four (4) modules. I have looked if there is some limit on importing of modules but didn’t find anything.

Hope its making sense.

Sorry that I can’t help you more… this would need proper debugging to find what is the real cause…

What is strange to me is the you are importing those models inside the relation() method ? (I did spell it wrongly before - rules)

Try to import them in the init() method for example.

ok will try it like that

thanks :)