I have a design like below
I have two independent modules and one common module. That means independent module will pull information from common module.
I defined below in common module config.
<config>
<global>
<models>
<services>
<class>My_Common_Model</class>
<services>
<models>
</global>
</config>
Then I tried to call a method in common module model from module_1 controller like below,
$stores = Mage::getModel('services/store')->getAvailableStore();
But is throws error like model undefined.
Then I included the common model configuration in Module_1 config.xml also. Its working now.
Is it the normal behavior? Cant we call any method in one modules model from other modules controller with defined tag in its native module itself?
I don't know how to ask this question better than this.
Module 1 Controller:
<?php
class My_Module_UserController extends Mage_Core_Controller_Front_Action{
function userAssignStoreAction(){
$stores = Mage::getModel('stores/store')->getAvailableStore();
echo $productModel;
die;
}
}
?>
below is common module config file:
<config>
<modules>
<My_Common>
<version>0.0.1</version>
</My_Common>
</modules>
<global>
<models>
<stores>
<class>My_Common_Model</class>
</stores>
</models
</global>
</config>
below is module 1 config:
<global>
<models>
<services>
<class>My_Module_Model</class>
</services>
<!-- WITHOUT BELOW DECLARATION UNABLE TO CALL COMMON MODEL METHOD FROM MODULE 1 CONTROLLER -->
<stores>
<class>My_Common_Model</class>
</stores>
</models>
</global>