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


PHP Doctrine_Table::getColumns方法代码示例

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


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

示例1: _getColumns

 /**
  * Return all columns
  * @return array
  */
 protected function _getColumns()
 {
     $columns = array();
     foreach ($this->_table->getColumns() as $name => $definition) {
         if (isset($definition['primary']) && $definition['primary'] || !isset($this->_columnTypes[$definition['type']]) || in_array($name, $this->_ignoreColumns)) {
             continue;
         }
         $definition['fieldName'] = $this->_table->getFieldName($name);
         $columns[$name] = $definition;
     }
     return $columns;
 }
开发者ID:abtris,项目名称:zfcore,代码行数:16,代码来源:DoctrineForm.php

示例2: getColumns

 /**
  * Return all columns as an array
  *
  * Array must contain 'type' for column type, 'notnull' true/false
  * for the column's nullability, and 'values' for enum values, 'primary'
  * true/false for primary key. Key = column's name
  *
  * @return array
  */
 public function getColumns()
 {
     $foreignKeyColumns = array();
     foreach ($this->_table->getRelations() as $alias => $relation) {
         $localColumn = strtolower($relation['local']);
         $foreignKeyColumns[$localColumn] = $relation['class'];
     }
     $data = $this->_table->getColumns();
     $cols = array();
     foreach ($data as $name => $def) {
         $isPrimary = isset($def['primary']) ? $def['primary'] : false;
         $isForeignKey = isset($foreignKeyColumns[strtolower($name)]);
         $columnName = $this->_table->getColumnName($name);
         $fieldName = $this->_table->getFieldName($columnName);
         $cols[$fieldName] = array('type' => $def['type'], 'notnull' => isset($def['notnull']) ? $def['notnull'] : false, 'values' => isset($def['values']) ? $def['values'] : array(), 'primary' => $isPrimary, 'foreignKey' => $isForeignKey, 'class' => $isForeignKey ? $foreignKeyColumns[strtolower($name)] : null);
     }
     return $cols;
 }
开发者ID:lciolecki,项目名称:zf-doctrine,代码行数:27,代码来源:Doctrine.php

示例3: generateClassFromTable

 public function generateClassFromTable(Doctrine_Table $table)
 {
     $definition = array();
     $definition['columns'] = $table->getColumns();
     $definition['tableName'] = $table->getTableName();
     $definition['actAs'] = $table->getTemplates();
     $definition['generate_once'] = true;
     $generatedclass = $this->generateClass($definition);
     Doctrine::loadModels(sfConfig::get('sf_lib_dir') . '/model/doctrine/opCommunityTopicPlugin/base/');
     return $generatedclass;
 }
开发者ID:niryuu,项目名称:opCommunityTopicPlugin-100628,代码行数:11,代码来源:opCommunityTopicPluginImagesRecordGenerator.class.php

示例4: generateClassFromTable

 /**
  * Generate a Doctrine_Record from a populated Doctrine_Table instance
  *
  * @param Doctrine_Table $table
  * @return void
  */
 public function generateClassFromTable(Doctrine_Table $table)
 {
     $definition = array();
     $definition['columns'] = $table->getColumns();
     $definition['tableName'] = $table->getTableName();
     $definition['actAs'] = $table->getTemplates();
     return $this->generateClass($definition);
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:14,代码来源:Generator.php

示例5: applyFieldsFromDoctrineRelation

 public function applyFieldsFromDoctrineRelation(Doctrine_Table $table)
 {
     foreach ($table->getColumns() as $column => $meta) {
         $options = array('sortType' => AppKitExtDataInterface::doctrineColumn2ExtSortType($meta['type']));
         if (isset($meta['primary']) && $meta['primary'] == true) {
             $this->setMeta(self::PROPERTY_ID, $column);
         }
         $this->hasField($column, $options);
     }
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:10,代码来源:AppKitExtJsonDocument.class.php

示例6: listColumns

 /**
  * Provides a array of columns
  *
  * @param Doctrine_Table $table The current Doctrine_Table
  *
  * @return array
  */
 private function listColumns(Doctrine_Table $table)
 {
     $ret = array();
     foreach ($table->getColumns() as $name => $column) {
         if (empty($column['primary'])) {
             $added = true;
             foreach ($table->getRelations() as $relation) {
                 if ($relation instanceof Doctrine_Relation_LocalKey && $relation->getLocal() === $name) {
                     $added = false;
                     break;
                 }
             }
             if ($added) {
                 $ret[] = sprintf("%s (%s)", $name, $column['type']);
             }
         }
     }
     return $ret;
 }
开发者ID:yuxw75,项目名称:Surrogate,代码行数:26,代码来源:doctrineGraphvizMcdGenerator.class.php

示例7: isValid

 /**
  * @return bool
  */
 public function isValid()
 {
     $tableColumns = $this->_table->getColumns();
     $dirtyColumns = $this->_data->getModified();
     foreach ($dirtyColumns as $key => $value) {
         unset($dirtyColumns[$key]);
         $dirtyColumns[strtolower($key)] = $value;
     }
     #die(Zend_Debug::dump($tableColumns));
     foreach ($tableColumns as $columnName => $columnStructure) {
         if (array_key_exists($columnName, $dirtyColumns)) {
             $validatorChain = new Zend_Validate();
             // Notnull
             if (array_key_exists('notnull', $columnStructure)) {
                 $validatorChain->addValidator(new Zend_Validate_NotEmpty(array('string' => true, 'empty_array' => true, 'null' => true, 'space' => true)));
             }
             // Email
             if (array_key_exists('email', $columnStructure)) {
                 $validatorChain->addValidator(new Zend_Validate_EmailAddress());
             }
             // Notblank
             if (array_key_exists('notblank', $columnStructure)) {
                 $validatorChain->addValidator(new Kebab_Validate_NotBlank());
             }
             // Nospace
             if (array_key_exists('nospace', $columnStructure)) {
                 // check null
                 $validatorChain->addValidator(new Zend_Validate_NotEmpty(array('null' => true)));
                 // check space
                 $validatorChain->addValidator(new Zend_Validate_Regex(array('pattern' => '/\\s/')));
             }
             // Past
             // Future
             // Min Length
             if (array_key_exists('minlength', $columnStructure)) {
                 $validatorChain->addValidator(new Zend_Validate_GreaterThan(array('min' => $columnStructure['minlength'])));
             }
             // Country
             // Ip
             if (array_key_exists('ip', $columnStructure)) {
                 $validatorChain->addValidator(new Zend_Validate_Ip());
             }
             // HtmlColor
             // Range
             if (array_key_exists('range', $columnStructure)) {
                 $validatorChain->addValidator(new Zend_Validate_Between(array('min' => $columnStructure['range'][0], 'max' => $columnStructure['range'][1])));
             }
             //Unique
             if (array_key_exists('unique', $columnStructure)) {
                 $validatorChain->addValidator(new Kebab_Validate_Unique($columnName, $this->_data));
             }
             // Regex
             if (array_key_exists('regexp', $columnStructure)) {
                 $validatorChain->addValidator(new Zend_Validate_Regex(array('pattern' => $columnStructure['regexp'])));
             }
             // Digits
             if (array_key_exists('digits', $columnStructure)) {
                 $validatorChain->addValidator(new Zend_Validate_Digits());
             }
             // Date
             if (array_key_exists('date', $columnStructure)) {
                 $validatorChain->addValidator(new Zend_Validate_Date());
             }
             // CC
             if (array_key_exists('cc', $columnStructure)) {
                 $validatorChain->addValidator(new Zend_Validate_CreditCard());
             }
             // Unsigned
             // Check All
             if (!$validatorChain->isValid($dirtyColumns[$columnName])) {
                 $translator = Zend_Registry::get('Zend_Translate');
                 Zend_Validate_Abstract::setDefaultTranslator($translator);
                 $this->_errors[$columnName] = $validatorChain->getMessages();
             }
             unset($validatorChain);
         }
     }
     if (count($this->_errors) > 0) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:esironal,项目名称:kebab-project,代码行数:86,代码来源:DoctrineTable.php


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