File indexing completed on 2024-05-26 06:02:44

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Application
0017  * @subpackage Module
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @version    $Id$
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  */
0022 
0023 /** @see Zend_Loader_Autoloader_Resource */
0024 // require_once 'Zend/Loader/Autoloader/Resource.php';
0025 
0026 /**
0027  * Resource loader for application module classes
0028  *
0029  * @uses       Zend_Loader_Autoloader_Resource
0030  * @category   Zend
0031  * @package    Zend_Application
0032  * @subpackage Module
0033  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0034  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0035  */
0036 class Zend_Application_Module_Autoloader extends Zend_Loader_Autoloader_Resource
0037 {
0038     /**
0039      * Constructor
0040      *
0041      * @param  array|Zend_Config $options
0042      */
0043     public function __construct($options)
0044     {
0045         parent::__construct($options);
0046         $this->initDefaultResourceTypes();
0047     }
0048 
0049     /**
0050      * Initialize default resource types for module resource classes
0051      *
0052      * @return void
0053      */
0054     public function initDefaultResourceTypes()
0055     {
0056         $basePath = $this->getBasePath();
0057         $this->addResourceTypes(
0058             array(
0059                 'dbtable'    => array(
0060                     'namespace' => 'Model_DbTable',
0061                     'path'      => 'models/DbTable',
0062                 ),
0063                 'mappers'    => array(
0064                     'namespace' => 'Model_Mapper',
0065                     'path'      => 'models/mappers',
0066                 ),
0067                 'form'       => array(
0068                     'namespace' => 'Form',
0069                     'path'      => 'forms',
0070                 ),
0071                 'model'      => array(
0072                     'namespace' => 'Model',
0073                     'path'      => 'models',
0074                 ),
0075                 'plugin'     => array(
0076                     'namespace' => 'Plugin',
0077                     'path'      => 'plugins',
0078                 ),
0079                 'service'    => array(
0080                     'namespace' => 'Service',
0081                     'path'      => 'services',
0082                 ),
0083                 'viewhelper' => array(
0084                     'namespace' => 'View_Helper',
0085                     'path'      => 'views/helpers',
0086                 ),
0087                 'viewfilter' => array(
0088                     'namespace' => 'View_Filter',
0089                     'path'      => 'views/filters',
0090                 ),
0091             )
0092         );
0093         $this->setDefaultResourceType('model');
0094     }
0095 }