views:

42

answers:

3

hi all, i am developing an application using zend framework.

i have two modules, admin and default, and each of them has their specific model directory.

i want to know, if i can instantiate a model in admin module from within default module and if this approach has problem regarding to the MVC model.

thx in advance.

A: 

You can call get_class(): http://us3.php.net/get_class

There's possibly a more zend like way to do it, but I don't know. Check the docs.

Mr-sk
+2  A: 

So long as youve set up the Zend_Application_Resource_Modules or something pretty equivalent all you models should be registerd with the autoloader via the Zend_Application_Module_Autoloader that the modules resources registers. In short, if you follow the default way of doing things, then Models from all modules will be set up for Autoloading in the bootstrap phase.

About Zend Application and Resources

prodigitalson
A: 

What about call via object? Like inter-connect two model functions in controller.

$contacts = new Model_DbTable_Contactsmdl(); // Model file in contact module

$update_id = $contacts->updateContacts($cn_id', $responsearray);

This code inside my syncController.

So you can handle admin / model function in default / controller.

Sadee