This message is intended for @weierophinney, but feel free to pitch in if you
have a solution. :) This might be an easy one for you guys!
The short story is that I'm giving Zend_Loader_Autoloader_Resource
(incubator) a spin and have run into some unexpected behavior. It seems to
load my classes correctly (my page will display with the expected
information from the database) but Zend_Loader complains with some warnings:
Warning: Zend_Loader::include_once(Projects/Model/Projects.php)
[function.Zend-Loader-include-once]: failed to open stream: No such file or
directory in /[...]/library/Zend/Loader.php on line 83
Warning: Zend_Loader::include_once() [function.include]: Failed opening
'Projects/Model/Projects.php' for inclusion (include_path='[...]') in
/[...]/library/Zend/Loader.php on line 83
Warning: Zend_Loader::include_once(Projects/DbTable/Projects.php)
[function.Zend-Loader-include-once]: failed to open stream: No such file or
directory in /[...]/library/Zend/Loader.php on line 83
Warning: Zend_Loader::include_once() [function.include]: Failed opening
'Projects/DbTable/Projects.php' for inclusion (include_path='[...]') in
/[...]/library/Zend/Loader.php on line 83
So, it seems to be attempting to include the classes from my include path.
My assumption is that Zend_Loader_Autoloader_Resource should take care of
everything (like taking overriding the processing of namespaces in such a
way that the default Zend_Loader actions are never executed) and I shouldn't
need to touch my include_path.
Is there something I need to do in my bootstrap prior to using ZLAR to avoid
that include conflict? Right now the bootstrap has nothing specific to ZLAR
and I'm just instantiating it in my modules' index controller init()
functions like so:
$loader = new Zend_Loader_Autoloader_Resource(array(
'namespace' => 'Projects',
'basePath' => dirname(__FILE__) . '/..'
));
$loader->addResourceTypes(array(
'Model' => array('path' => 'models', 'namespace' => 'Model'),
'DbTable' => array('path' => 'models/DbTable', 'namespace' =>
'DbTable')
));
... where my directory structure is:
/application
/modules (just showing one for illustration)
/projects
/controllers
IndexController.php
/forms
/models
/DbTable
Categories.php
Features.php
ProjectCategories.php
ProjectFeatures.php
Projects.php
ProjectsSimilar.php
Projects.php
/views
Maybe I'm violating "best practices" for ZLAR, who knows. :) Hopefully there
is a quick fix!
Regards,
August
--
View this message in context:
http://www.nabble.com/Issue%3A-Resource-autoloading-with-Zend_Loader_Autoloader_Resource-%28incubator%29-tp22232795p22232795.html
Sent from the Zend Framework mailing list archive at Nabble.com.