« Return to Thread: Shared Models in Different Modules

Re: Shared Models in Different Modules

by Behzad-3 :: Rate this Message:

Reply to Author | View in Thread

That's exactly what i am talking about it, and, yes, it requires a massive shift.

Why should we use:
$this->_helper->ModuleLoader('News_Story');
instead of:
Zend_Loader::loadClass('News_Story');
?

To achieve this, we should follow a consistent naming scheme

among controllers and models, and that scheme should be compatible
with Zend_Loader.

Forget the models for a moment, but the inconsistency still remains:
Currently, we name our controllers X_Y_Z,
but we store them in X/controllers/ZY.php !


What's wrong with: X/Y/Z.php ? It's compatible with Zend_Loader.

Zend_Loader and its scheme is created to facilitate loading classes in a
Modular-MVC architecute, whereas it is currently unable to achieve this,
because of inconsistent naming schemes.

Zend_Loader::loadClass('Foo_Controller_Bar');
// loads: foo/controllers/bar.php

Zend_Loader::loadClass('Foo_Model_Bar');
// loads: foo/models/bar.php

Not only this naming scheme keeps the directory structure which is
recommend in the manual, but also it allows the Zend_Loader to load
every class in the MVC-architecture, and no patches is required.

 « Return to Thread: Shared Models in Different Modules