web/lib/Zend/Application/Module/Autoloader.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     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-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    19  * @version    $Id: Autoloader.php 20250 2010-01-12 22:15:20Z dasprid $
       
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    21  */
       
    22 
       
    23 /** @see Zend_Loader_Autoloader_Resource */
       
    24 require_once 'Zend/Loader/Autoloader/Resource.php';
       
    25 
       
    26 /**
       
    27  * Resource loader for application module classes
       
    28  *
       
    29  * @uses       Zend_Loader_Autoloader_Resource
       
    30  * @category   Zend
       
    31  * @package    Zend_Application
       
    32  * @subpackage Module
       
    33  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    34  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    35  */
       
    36 class Zend_Application_Module_Autoloader extends Zend_Loader_Autoloader_Resource
       
    37 {
       
    38     /**
       
    39      * Constructor
       
    40      *
       
    41      * @param  array|Zend_Config $options
       
    42      * @return void
       
    43      */
       
    44     public function __construct($options)
       
    45     {
       
    46         parent::__construct($options);
       
    47         $this->initDefaultResourceTypes();
       
    48     }
       
    49 
       
    50     /**
       
    51      * Initialize default resource types for module resource classes
       
    52      *
       
    53      * @return void
       
    54      */
       
    55     public function initDefaultResourceTypes()
       
    56     {
       
    57         $basePath = $this->getBasePath();
       
    58         $this->addResourceTypes(array(
       
    59             'dbtable' => array(
       
    60                 'namespace' => 'Model_DbTable',
       
    61                 'path'      => 'models/DbTable',
       
    62             ),
       
    63             'mappers' => array(
       
    64                 'namespace' => 'Model_Mapper',
       
    65                 'path'      => 'models/mappers',
       
    66             ),
       
    67             'form'    => array(
       
    68                 'namespace' => 'Form',
       
    69                 'path'      => 'forms',
       
    70             ),
       
    71             'model'   => array(
       
    72                 'namespace' => 'Model',
       
    73                 'path'      => 'models',
       
    74             ),
       
    75             'plugin'  => array(
       
    76                 'namespace' => 'Plugin',
       
    77                 'path'      => 'plugins',
       
    78             ),
       
    79             'service' => array(
       
    80                 'namespace' => 'Service',
       
    81                 'path'      => 'services',
       
    82             ),
       
    83             'viewhelper' => array(
       
    84                 'namespace' => 'View_Helper',
       
    85                 'path'      => 'views/helpers',
       
    86             ),
       
    87             'viewfilter' => array(
       
    88                 'namespace' => 'View_Filter',
       
    89                 'path'      => 'views/filters',
       
    90             ),
       
    91         ));
       
    92         $this->setDefaultResourceType('model');
       
    93     }
       
    94 }