Autoloader.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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-2015 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-2015 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(
  55. 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. );
  90. $this->setDefaultResourceType('model');
  91. }
  92. }