Autoloader Resource File
1 2 3 4 56 7 8 9 1011 12 13 14 1516 17 18 19 2021 22 23 24 2526 27 28 29 3031 32 33 34 3536 37 38 39 4041 42 43 44 4546 47 | class App_Application_Resource_Autoloader extends Zend_Application_Resource_ResourceAbstract { /** * Autloader instance * @var Zend_Loader_Autoloader */ private $_autoloader = null; /** * Initialising * @return Zend_Loader_Autoloader */ public function init() { $this->_getAutoloaderInstance(); $this->_configureAutoloader($this->getOptions ()); return $this->_autoloader; } /** * Configuring autoloader * @param array * @return null */ protected function _configureAutoloader ($options) { foreach ( $options as $optionName => $optionValue ) switch (strtolower ( $optionName )) { case 'enablefallbackautoloader' : $this->_autoloader->setFallbackAutoloader ( $optionValue ); break; case 'suppressnotfoundwarnings' : $this->_autoloader->suppressNotFoundWarnings ( $optionValue ); break; //You may add cases for other autoload options if you need } } /** * Get auloader instance * @return Zend_Loader_Autoloader */ private function _getAutoloaderInstance() { if (null === $this->_autoloader) { $this->_autoloader = Zend_Loader_Autoloader::getInstance (); } return $this->_autoloader; } } |
1 2 3 | #Usage in config files resources.autoloader.enableFallbackAutoloader = yes resources.autoloader.suppressNotFoundWarnings = no |
Comments
You must login before commenting on a snippet. If you do not have an account, please register.
Snippet description
Configuring resource for autoloading
Snippet details
- Created:
-
alex
- Edited:
-
alex
- Revision Id:
- 137
- Edit Message:
- Initial Release
- ZF Version
- 1.8.3
- Tags:
- resource autoloading
- Comments:
- 1
- Views:
- 396
- Points:
- 0 (0 votes)
7 months ago
thx u, man=)