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


PHP ZendT_Lib::convertTableNameToObjectName方法代码示例

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


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

示例1: config

 /**
  *
  * @param string $table
  * @param string $adapter
  * @param string $module 
  * @return void
  * @throws Zend_Tool_Project_Exception
  * @throws Exception 
  */
 public function config($table, $adapter, $module = null, $name = null, $env = null, $schema = null)
 {
     if (!$schema) {
         $schema = $adapter;
     }
     $this->_print(' Criando arquivo de configuracao ');
     $this->_print(' table: ' . $table . ' | adapter : ' . $adapter . ' | module: ' . $module);
     $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION);
     $table = strtolower($table);
     $module = strtolower($module);
     if ($name !== null) {
         $controllerName = strtolower(str_replace('_', '-', $name));
     } else {
         $controllerName = strtolower(str_replace('_', '-', $table));
     }
     $path = $this->_loadedProfile->getAttribute('projectDirectory');
     $this->_configModule($path, $module);
     $dirModules = $path . '/application/configs/modules';
     if (!is_dir($dirModules)) {
         mkdir($dirModules);
     }
     $dirModule = $dirModules . '/' . $module;
     if (!is_dir($dirModule)) {
         mkdir($dirModule);
     }
     $fileName = $dirModule . '/' . $table . '.php';
     /**
      * 
      */
     $config = array();
     if (!file_exists($fileName)) {
         $config['table']['name'] = $table;
         if ($name != null || $name) {
             $config['table']['modelName'] = $name;
         } else {
             $config['table']['modelName'] = $table;
         }
         $config['table']['schema'] = $adapter;
         $config['table']['sequenceName'] = 'sid_' . $table;
         $config['table']['moduleName'] = $module;
         $config['table']['objectName'] = str_replace("_Crud", "", ZendT_Lib::convertTableNameToObjectName($module, $config['table']['modelName']));
         $config['table']['controllerName'] = str_replace("Model_", "", $config['table']['objectName']) || 'Controller';
         $config['table']['seeker']['field']['search'] = '';
         $config['table']['seeker']['field']['display'] = '';
         $config['table']['seeker']['search']['css-width'] = '270px';
         $config['table']['seeker']['display']['css-width'] = '0px';
         $config['table']['seeker']['url']['grid'] = "/{$module}/{$controllerName}/grid";
         $config['table']['seeker']['url']['search'] = "/{$module}/{$controllerName}/seeker-search";
         $config['table']['seeker']['url']['retrieve'] = "/{$module}/{$controllerName}/retrieve";
         $config['table']['seeker']['modal']['width'] = 800;
         $config['table']['seeker']['modal']['height'] = 450;
     } else {
         $config = (require $fileName);
     }
     $config['table']['seeker']['field']['id'] = array();
     $this->_connect($this->_loadedProfile, $adapter, $env);
     $describeModel = $this->_dbAdapter->describeTable($table, $schema);
     if (count($describeModel) <= 0) {
         $this->_print('Erro ao localizar as colunas da Tabela, certifique a conexao e nome da tabela');
         exit;
     } else {
         /**
          * 
          */
         /* if (!isset($config['table']['columns'])) {
            $config['table']['columns'] = array();
            } */
         /**
          * Força para manter a ordem das colunas
          */
         foreach ($describeModel as $columnName => $column) {
             if (!isset($config['table']['columns'][$columnName])) {
                 if (!$config['table']['columns'][strtolower($columnName)]['label']) {
                     $config['table']['columns'][strtolower($columnName)]['label'] = $columnName;
                 }
             }
         }
     }
     //print_r($describeModel);
     //$describeModel['PRECISION'] = (int) $describeModel['PRECISION'];
     if (!isset($config['table']['dependentTables'])) {
         $config['table']['dependentTables'] = array();
     }
     if (!isset($config['table']['referenceMaps'])) {
         $config['table']['referenceMaps'] = array();
     }
     if (isset($describeModel['REFERENCE_MAP'])) {
         $_referenceMaps = array();
         foreach ($describeModel['REFERENCE_MAP'] as &$reference) {
             $modelName = ZendT_Tool_Crud::getModelName($this->_loadedProfile->getAttribute('projectDirectory'), $reference['TABLE_NAME_REFERENCE'], $reference['SCHEMA_NAME_REFERENCE']);
             if ($modelName) {
//.........这里部分代码省略.........
开发者ID:rtsantos,项目名称:mais,代码行数:101,代码来源:CrudTProvider.php


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