I need to intantiate several times a module.
After researching, I figured out that itcould be done in this way:
'modules' => array( 'instance_1' => array( 'class' => 'application.modules.mymodule.MyModuleModule', 'table' => 'table_1', 'parameter_1' => 'value_1', ... 'parameter_N' => 'value_N', ), 'instance_2' => array( 'class' => 'application.modules.mymodule.MyModuleModule', 'table' => 'table_2', 'parameter_1' => 'value_1', ... 'parameter_N' => 'value_N', ) ...
At least i got this: when I use the MyModule in the “menu”: array(‘label’ => ‘Instance_1’, ‘url’ => array(’/instance_1/mymodulecontroller/index’)… I can get it work becouse I can use getController…
If I use one of that instances in this way
I know the name of the instance, because in MyModuleController.php, $this refers to MyModuleModule instance and with its ID I can know name and instance configuration.
But in MyModule.php (model) I’ve “lost” this “identification and configuration” ie: table name is on module configuration
So, how I can know the "instance name" in every place of the module: controllers and models, no matter how I instantiate it or get to the module model or module controller.
I already tried, with no success:
Use “init()” with getController(), doesn’t work when I use the instatiation as showed above;
Use "__construct" with "init()" in the model, when enters in "init()", the variables setted in "__contruct()" are empty;
I need to do it in that way: instantiating the module as many times as I need, configurating the name of the tables (different in each instance) and its messages…
Thanks in advance…