예제 #1
0
파일: Table.php 프로젝트: huang-sh/yaf.app
 protected function setupRowPrototype($rowPrototype)
 {
     if (!$rowPrototype && ($loader = MountManager::getInstance()->get('RowLoader'))) {
         $rowPrototype = $loader->get($this->getTable()->getTable());
     }
     $this->rowPrototype = $rowPrototype;
 }
예제 #2
0
파일: Module.php 프로젝트: huang-sh/yaf.app
 /**
  * yaf路由分发之前触发,完成读取模块自定义配置
  *
  * @access public
  * @param \Yaf\Request_Abstract $request
  * @param \Yaf\Response_Abstract $response
  * @return void
  */
 public function preDispatch(Request_Abstract $request, Response_Abstract $response)
 {
     $module_dir = ROOT_PATH . DS . APP_NAME . DS . 'modules' . DS . $request->module . DS;
     do {
         if (!file_exists($module_dir . 'config' . DS . 'Import.php')) {
             break;
         }
         $module_config = (include $module_dir . 'config' . DS . 'Import.php');
         if (!is_array($module_config)) {
             break;
         }
         $mount = MountManager::getInstance();
         $config = array();
         foreach ($module_config as $name => $option) {
             if (!is_string($option) && !is_callable($option) && !is_object($option)) {
                 $config[$name] = $option;
             } else {
                 if (is_string($option)) {
                     $config[$name] = $option;
                 } else {
                     $mount->mount($name, $option);
                 }
             }
         }
         $simple_config = new Simple($config, true);
         Registry::set("config", $simple_config);
         Registry::set("mount", $mount);
     } while (0);
 }