当前位置: 首页>>代码示例>>PHP>>正文


PHP MidasLoader::loadModels方法代码示例

本文整理汇总了PHP中MidasLoader::loadModels方法的典型用法代码示例。如果您正苦于以下问题:PHP MidasLoader::loadModels方法的具体用法?PHP MidasLoader::loadModels怎么用?PHP MidasLoader::loadModels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MidasLoader的用法示例。


在下文中一共展示了MidasLoader::loadModels方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadModels

 /**
  * Load multiple models into the Zend registry.
  *
  * @param array|string $models names of the models to load
  * @param string $module name of the module from which to load the models, defaults to core
  * @deprecated replaced by void MidasLoader::loadModels(array|string $model, string $module)
  */
 public function loadModels($models, $module = '')
 {
     MidasLoader::loadModels($models, $module);
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:11,代码来源:ModelLoader.php

示例2: loadElements

 /** Load components, forms, and models. */
 public function loadElements()
 {
     Zend_Registry::set('models', array());
     if (isset($this->_models)) {
         MidasLoader::loadModels($this->_models);
     }
     $modelsArray = Zend_Registry::get('models');
     foreach ($modelsArray as $key => $tmp) {
         $this->{$key} = $tmp;
     }
     if (isset($this->_daos)) {
         foreach ($this->_daos as $dao) {
             Zend_Loader::loadClass($dao . 'Dao', BASE_PATH . '/core/models/dao');
         }
     }
     Zend_Registry::set('components', array());
     if (isset($this->_components)) {
         foreach ($this->_components as $component) {
             $nameComponent = $component . 'Component';
             Zend_Loader::loadClass($nameComponent, BASE_PATH . '/core/controllers/components');
             if (!isset($this->Component)) {
                 $this->Component = new stdClass();
             }
             if (!class_exists($nameComponent)) {
                 throw new Zend_Exception('Unable to find ' . $nameComponent);
             }
             $this->Component->{$component} = new $nameComponent();
         }
     }
     Zend_Registry::set('forms', array());
     if (isset($this->_forms)) {
         foreach ($this->_forms as $forms) {
             $nameForm = $forms . 'Form';
             Zend_Loader::loadClass($nameForm, BASE_PATH . '/core/controllers/forms');
             if (!isset($this->Form)) {
                 $this->Form = new stdClass();
             }
             if (!class_exists($nameForm)) {
                 throw new Zend_Exception('Unable to find ' . $nameForm);
             }
             $this->Form->{$forms} = new $nameForm();
         }
     }
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:45,代码来源:GlobalController.php

示例3: loadModuleElements

 /** Load model and components. */
 public function loadModuleElements()
 {
     if (isset($this->_moduleModels)) {
         MidasLoader::loadModels($this->_moduleModels, $this->moduleName);
         $modelsArray = Zend_Registry::get('models');
         foreach ($this->_moduleModels as $value) {
             if (isset($modelsArray[$this->moduleName . $value])) {
                 $tmp = ucfirst($this->moduleName) . '_' . $value;
                 $this->{$tmp} = $modelsArray[$this->moduleName . $value];
             }
         }
     }
     if (isset($this->_moduleDaos)) {
         foreach ($this->_moduleDaos as $dao) {
             if (file_exists(BASE_PATH . '/modules/' . $this->moduleName . '/models/dao/' . $dao . 'Dao.php')) {
                 include_once BASE_PATH . '/modules/' . $this->moduleName . '/models/dao/' . $dao . 'Dao.php';
             } elseif (file_exists(BASE_PATH . '/privateModules/' . $this->moduleName . '/models/dao/' . $dao . 'Dao.php')) {
                 include_once BASE_PATH . '/privateModules/' . $this->moduleName . '/models/dao/' . $dao . 'Dao.php';
             } else {
                 throw new Zend_Exception('Unable to find dao  ' . $dao);
             }
         }
     }
     if (isset($this->_moduleComponents)) {
         foreach ($this->_moduleComponents as $component) {
             $nameComponent = ucfirst($this->moduleName) . '_' . $component . 'Component';
             if (file_exists(BASE_PATH . '/modules/' . $this->moduleName . '/controllers/components/' . $component . 'Component.php')) {
                 include_once BASE_PATH . '/modules/' . $this->moduleName . '/controllers/components/' . $component . 'Component.php';
             } elseif (file_exists(BASE_PATH . '/privateModules/' . $this->moduleName . '/controllers/components/' . $component . 'Component.php')) {
                 include_once BASE_PATH . '/privateModules/' . $this->moduleName . '/controllers/components/' . $component . 'Component.php';
             } else {
                 throw new Zend_Exception('Unable to find components  ' . $component);
             }
             if (!class_exists($nameComponent)) {
                 throw new Zend_Exception('Unable to find ' . $nameComponent);
             }
             if (!isset($this->ModuleComponent)) {
                 $this->ModuleComponent = new stdClass();
             }
             $this->ModuleComponent->{$component} = new $nameComponent();
         }
     }
     if (isset($this->_moduleForms)) {
         foreach ($this->_moduleForms as $forms) {
             $nameForm = ucfirst($this->moduleName) . '_' . $forms . 'Form';
             include_once BASE_PATH . '/modules/' . $this->moduleName . '/controllers/forms/' . $forms . 'Form.php';
             if (file_exists(BASE_PATH . '/modules/' . $this->moduleName . '/controllers/forms/' . $forms . 'Form.php')) {
                 include_once BASE_PATH . '/modules/' . $this->moduleName . '/controllers/forms/' . $forms . 'Form.php';
             } elseif (file_exists(BASE_PATH . '/privateModules/' . $this->moduleName . '/controllers/forms/' . $forms . 'Form.php')) {
                 include_once BASE_PATH . '/privateModules/' . $this->moduleName . '/controllers/forms/' . $forms . 'Form.php';
             } else {
                 throw new Zend_Exception('Unable to find form  ' . $forms);
             }
             if (!class_exists($nameForm)) {
                 throw new Zend_Exception('Unable to find ' . $nameForm);
             }
             if (!isset($this->ModuleForm)) {
                 $this->ModuleForm = new stdClass();
             }
             $this->ModuleForm->{$forms} = new $nameForm();
         }
     }
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:64,代码来源:GlobalModule.php


注:本文中的MidasLoader::loadModels方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。