Autoloader.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Application
  17. * @subpackage Module
  18. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @version $Id$
  20. * @license http://framework.zend.com/license/new-bsd New BSD License
  21. */
  22. /** @see Zend_Loader_Autoloader_Resource */
  23. require_once 'Zend/Loader/Autoloader/Resource.php';
  24. /**
  25. * Resource loader for application module classes
  26. *
  27. * @uses Zend_Loader_Autoloader_Resource
  28. * @category Zend
  29. * @package Zend_Application
  30. * @subpackage Module
  31. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  32. * @license http://framework.zend.com/license/new-bsd New BSD License
  33. */
  34. class Zend_Application_Module_Autoloader extends Zend_Loader_Autoloader_Resource
  35. {
  36. /**
  37. * Constructor
  38. *
  39. * @param array|Zend_Config $options
  40. * @return void
  41. */
  42. public function __construct($options)
  43. {
  44. parent::__construct($options);
  45. $this->initDefaultResourceTypes();
  46. }
  47. /**
  48. * Initialize default resource types for module resource classes
  49. *
  50. * @return void
  51. */
  52. public function initDefaultResourceTypes()
  53. {
  54. $basePath = $this->getBasePath();
  55. $this->addResourceTypes(array(
  56. 'dbtable' => array(
  57. 'namespace' => 'Model_DbTable',
  58. 'path' => 'models/DbTable',
  59. ),
  60. 'mappers' => array(
  61. 'namespace' => 'Model_Mapper',
  62. 'path' => 'models/mappers',
  63. ),
  64. 'form' => array(
  65. 'namespace' => 'Form',
  66. 'path' => 'forms',
  67. ),
  68. 'model' => array(
  69. 'namespace' => 'Model',
  70. 'path' => 'models',
  71. ),
  72. 'plugin' => array(
  73. 'namespace' => 'Plugin',
  74. 'path' => 'plugins',
  75. ),
  76. 'service' => array(
  77. 'namespace' => 'Service',
  78. 'path' => 'services',
  79. ),
  80. 'viewhelper' => array(
  81. 'namespace' => 'View_Helper',
  82. 'path' => 'views/helpers',
  83. ),
  84. 'viewfilter' => array(
  85. 'namespace' => 'View_Filter',
  86. 'path' => 'views/filters',
  87. ),
  88. ));
  89. $this->setDefaultResourceType('model');
  90. }
  91. }