osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: Making module dispatcher a real module dispatcher
- msg#00005

List: php.zend.framework.mvc

Mail Archive Navigation:
by Date: Prev Next Date Index by Thread: Prev Next Thread Index

I would like to touch the subject of modules once again.

If I understand correctly, the main reason for splitting the dispatcher
was to allow people to use standard dispatcher if they are not going to
use modules. It's perfectly clear and understandable. Now, when it comes
to ModuleDispatcher I would think it's meant for the people wishing to use
modules in their software, right? So why module dispatcher is a hybrid
between these two worlds?

If you use modules then you probably don't keep your default module in
different directories, am I right?

I would rather see a cleaned up version of dispatcher without this magic
special case voodoo of iterating multiple default directiories based on the

module name alone. Do we really need that? I think we can rule out
backwards
compatibility in order to prepare "good code" for the ZF 1.0. For the sake
of
better OO and simplicity.

How about making ModuleDispatcher a strict module dispatcher? I mean to
allow
adding directories only when the module name is directly specified. And as
a
bonus, an ability to specify your own default module name, like it's being
done
now with controller and action names (in standard dispatcher).

Am I alone on this? To all reading this: please, express your support if
you
feel the same.


--
Martel Valgoerad aka Michal Minicki | martel-KmDv4U93n3M@xxxxxxxxxxxxxxxx |
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything."
-- Floyd Dell




Thread at a glance:

Previous Message by Date:

SVN 3133

Hi Matthew, Subversion commit 3133 has changed a fair amount. Is there a JIRA issue explaining it? Having a look through the patch, I like it as it seems cleaner in terms of class responsibilities. Especially, the dispatcher :) As a minor nitpick, line 93 of Zend/Controller/Response/Abstract.php could do with a more accurate error message :) Regards, Rob...

Next Message by Date:

Re: Making module dispatcher a real module dispatcher

First of all, I'm sorry for the messed up line-breaks. I hate using webmails but I don't have any other way to do it from where I am writing this. > I would rather see a cleaned up version of dispatcher without this > magic special case voodoo of iterating multiple default directiories > based on the module name alone. Do we really need that? I think we can > rule out backwards compatibility in order to prepare "good code" for > the ZF 1.0. For the sake of better OO and simplicity. To better illustrate what I am talking about. Let's get the actual addControllerDirectory method: public function addControllerDirectory($path, $args = null) { if ('default' == $args) { foreach ((array) $path as $dir) { if (!is_string($dir) || !is_dir($dir) || !is_readable($dir)) { require_once 'Zend/Controller/Dispatcher/Exception.php'; throw new Zend_Controller_Dispatcher_Exception("Directory ... } $this->_directories['default'][] = rtrim($dir, '/\\'); } } else { if (!is_string($path) || !is_dir($path) || !is_readable($path)) { require_once 'Zend/Controller/Dispatcher/Exception.php'; throw new Zend_Controller_Dispatcher_Exception("Directory ... } if (is_int($args) || empty($args) || ('default' == $args)) { $this->_directories['default'][] = rtrim($path, '/\\'); } else { $this->_directories[$args] = rtrim($path, '/\\'); } } return $this; } And make it stricted: public function addControllerDirectory($path, $module = 'default') { if (!is_dir($path) || !is_readable($path)) { require_once 'Zend/Controller/Dispatcher/Exception.php'; throw new Zend_Controller_Dispatcher_Exception("Directory \"$path\" not found or not readable"); } $this->_directories[$module] = rtrim($path, '/\\'); return $this; } -- Martel Valgoerad aka Michal Minicki | martel-KmDv4U93n3M@xxxxxxxxxxxxxxxx | http://aie.pl/martel.asc =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= "Idleness is not doing nothing. Idleness is being free to do anything." -- Floyd Dell

Previous Message by Thread:

SVN 3133

Hi Matthew, Subversion commit 3133 has changed a fair amount. Is there a JIRA issue explaining it? Having a look through the patch, I like it as it seems cleaner in terms of class responsibilities. Especially, the dispatcher :) As a minor nitpick, line 93 of Zend/Controller/Response/Abstract.php could do with a more accurate error message :) Regards, Rob...

Next Message by Thread:

Re: Making module dispatcher a real module dispatcher

First of all, I'm sorry for the messed up line-breaks. I hate using webmails but I don't have any other way to do it from where I am writing this. > I would rather see a cleaned up version of dispatcher without this > magic special case voodoo of iterating multiple default directiories > based on the module name alone. Do we really need that? I think we can > rule out backwards compatibility in order to prepare "good code" for > the ZF 1.0. For the sake of better OO and simplicity. To better illustrate what I am talking about. Let's get the actual addControllerDirectory method: public function addControllerDirectory($path, $args = null) { if ('default' == $args) { foreach ((array) $path as $dir) { if (!is_string($dir) || !is_dir($dir) || !is_readable($dir)) { require_once 'Zend/Controller/Dispatcher/Exception.php'; throw new Zend_Controller_Dispatcher_Exception("Directory ... } $this->_directories['default'][] = rtrim($dir, '/\\'); } } else { if (!is_string($path) || !is_dir($path) || !is_readable($path)) { require_once 'Zend/Controller/Dispatcher/Exception.php'; throw new Zend_Controller_Dispatcher_Exception("Directory ... } if (is_int($args) || empty($args) || ('default' == $args)) { $this->_directories['default'][] = rtrim($path, '/\\'); } else { $this->_directories[$args] = rtrim($path, '/\\'); } } return $this; } And make it stricted: public function addControllerDirectory($path, $module = 'default') { if (!is_dir($path) || !is_readable($path)) { require_once 'Zend/Controller/Dispatcher/Exception.php'; throw new Zend_Controller_Dispatcher_Exception("Directory \"$path\" not found or not readable"); } $this->_directories[$module] = rtrim($path, '/\\'); return $this; } -- Martel Valgoerad aka Michal Minicki | martel-KmDv4U93n3M@xxxxxxxxxxxxxxxx | http://aie.pl/martel.asc =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= "Idleness is not doing nothing. Idleness is being free to do anything." -- Floyd Dell
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!