Using modules path in relations


Does anybody knows how to describe module’s model relation in main application?

I try to describe it like …

‘items’=>array(self::MANY_MANY, ‘application.modules.unit.models.Item’, ‘order_unit_items(order_id, item_id)’),


[<a href=‘function.include’>function.include</a>]: failed to open stream: No such file or directory

but it doesn’t work

Best regards

In your modules init method, import the modules model path and then define the relation as usual.

class UnitModule extends CWebModule



   public function init()









'items'=>array(self::MANY_MANY, 'Item', 'order_unit_items(order_id, item_id)'),

// If you want to use a modules model in main application, add the modules model folder to the import-array in the config.