2009年7月10日星期五

[fw-mvc] Autoloader issue

Index: Autoloader.php
===================================================================
--- Autoloader.php (Revision 16622)
+++ Autoloader.php (Arbeitskopie)
@@ -305,7 +305,7 @@
if ('' == $ns) {
continue;
}
- if (0 === strpos($class, $ns)) {
+ if (0 === strpos($class, $ns . '_')) {
$namespace = $ns;
$autoloaders = $autoloaders + $this->getNamespaceAutoloaders($ns);
break;
Hi all,

I am using ZF 1.8 and have a small problem with the new autoloader.

The include_path contains two dirs:

/path/to/webapp/library
/path/to/webapp/application/doctrine/models

And I have three modules:

/path/to/webapp/application/modules/shop
/path/to/webapp/application/modules/user
/path/to/webapp/application/modules/cms


In my doctrine models directory is a "UserTable.php" file which contains
class "UserTable". If I try to load that class it fails because the zf
autoloader uses the module_autloader for the "user module".

If I try to load ProductTable class which resides in the same directory
it works fine because there is no module with the name "product" in place.

I tried to modify Zend/Loader/Autoloader.php to fix that, but I don´t
think its a good solution - but it works. Please see attachment for the
diff.


I really don´t like this workaround and would like to know if there is
another approach to solve the issue.


Thanks in advance,
-Jens

没有评论: