Autoloader.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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-2014 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-2014 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. */
  41. public function __construct($options)
  42. {
  43. parent::__construct($options);
  44. $this->initDefaultResourceTypes();
  45. }
  46. /**
  47. * Initialize default resource types for module resource classes
  48. *
  49. * @return void
  50. */
  51. public function initDefaultResourceTypes()
  52. {
  53. $basePath = $this->getBasePath();
  54. $this->addResourceTypes(array(
  55. 'dbtable' => array(
  56. 'namespace' => 'Model_DbTable',
  57. 'path' => 'models/DbTable',
  58. ),
  59. 'mappers' => array(
  60. 'namespace' => 'Model_Mapper',
  61. 'path' => 'models/mappers',
  62. ),
  63. 'form' => array(
  64. 'namespace' => 'Form',
  65. 'path' => 'forms',
  66. ),
  67. 'model' => array(
  68. 'namespace' => 'Model',
  69. 'path' => 'models',
  70. ),
  71. 'plugin' => array(
  72. 'namespace' => 'Plugin',
  73. 'path' => 'plugins',
  74. ),
  75. 'service' => array(
  76. 'namespace' => 'Service',
  77. 'path' => 'services',
  78. ),
  79. 'viewhelper' => array(
  80. 'namespace' => 'View_Helper',
  81. 'path' => 'views/helpers',
  82. ),
  83. 'viewfilter' => array(
  84. 'namespace' => 'View_Filter',
  85. 'path' => 'views/filters',
  86. ),
  87. ));
  88. $this->setDefaultResourceType('model');
  89. }
  90. }