2
0

Autoloader.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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-2008 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. /** 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. * @package Zend_Application
  29. * @subpackage Module
  30. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  31. * @license New BSD {@link http://framework.zend.com/license/new-bsd}
  32. */
  33. class Zend_Application_Module_Autoloader extends Zend_Loader_Autoloader_Resource
  34. {
  35. /**
  36. * Constructor
  37. *
  38. * @param array|Zend_Config $options
  39. * @return void
  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. 'form' => array(
  60. 'namespace' => 'Form',
  61. 'path' => 'forms',
  62. ),
  63. 'model' => array(
  64. 'namespace' => 'Model',
  65. 'path' => 'models',
  66. ),
  67. 'plugin' => array(
  68. 'namespace' => 'Plugin',
  69. 'path' => 'plugins',
  70. ),
  71. 'service' => array(
  72. 'namespace' => 'Service',
  73. 'path' => 'services',
  74. ),
  75. 'viewhelper' => array(
  76. 'namespace' => 'View_Helper',
  77. 'path' => 'views/helpers',
  78. ),
  79. 'viewfilter' => array(
  80. 'namespace' => 'View_Filter',
  81. 'path' => 'views/filters',
  82. ),
  83. ));
  84. $this->setDefaultResourceType('model');
  85. }
  86. }