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


PHP Table::hasColumn方法代码示例

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


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

示例1: addColumn

 protected function addColumn(Table $table, $name)
 {
     if (!$table->hasColumn($name)) {
         $column = new Column($name);
         // don't know how to define unsigned :(
         $domain = new Domain('TINYINT', 'tinyint(3) unsigned');
         $column->setDomain($domain);
         $table->addColumn($column);
         $column_idx_name = $name . '_idx';
         if (!$table->hasIndex($column_idx_name)) {
             $column_idx = new Index($column_idx_name);
             $column_idx->addColumn(['name' => $column->getName()]);
             $table->addIndex($column_idx);
         }
     }
 }
开发者ID:scif,项目名称:propel-closuretable-behavior,代码行数:16,代码来源:ClosureTableBehavior.php

示例2: testCantGetColumn

 public function testCantGetColumn()
 {
     $table = new Table('books');
     $this->assertFalse($table->hasColumn('FOO', true));
     $this->assertNull($table->getColumn('FOO'));
     $this->assertNull($table->getColumnByPhpName('Foo'));
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:7,代码来源:TableTest.php

示例3: addIndexes

 /**
  * Adds Indexes to the specified table.
  *
  * @param Table $table The Table model class to add columns to.
  */
 protected function addIndexes(Table $table)
 {
     $stmt = $this->dbh->query("SELECT COLUMN_NAME, INDEX_NAME FROM USER_IND_COLUMNS WHERE TABLE_NAME = '" . $table->getName() . "' ORDER BY COLUMN_NAME");
     $rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     $indices = array();
     foreach ($rows as $row) {
         $indices[$row['INDEX_NAME']][] = $row['COLUMN_NAME'];
     }
     foreach ($indices as $indexName => $columnNames) {
         $index = new Index($indexName);
         foreach ($columnNames as $columnName) {
             // Oracle deals with complex indices using an internal reference, so...
             // let's ignore this kind of index
             if ($table->hasColumn($columnName)) {
                 $index->addColumn($table->getColumn($columnName));
             }
         }
         // since some of the columns are pruned above, we must only add an index if it has columns
         if ($index->hasColumns()) {
             $table->addIndex($index);
         }
     }
 }
开发者ID:bondarovich,项目名称:Propel2,代码行数:28,代码来源:OracleSchemaParser.php

示例4: addLogColumns

 protected function addLogColumns(Table $table)
 {
     if ('true' === $this->getParameter('created_at') && !$table->hasColumn($this->getParameter('created_at_column'))) {
         $table->addColumn(array('name' => $this->getParameter('created_at_column'), 'type' => 'TIMESTAMP'));
     }
     if ('true' === $this->getParameter('created_by') && !$table->hasColumn($this->getParameter('created_by_column'))) {
         $table->addColumn(array('name' => $this->getParameter('created_by_column'), 'type' => 'VARCHAR', 'size' => 100));
     }
     if ('true' === $this->getParameter('comment') && !$table->hasColumn($this->getParameter('comment_column'))) {
         $table->addColumn(array('name' => $this->getParameter('comment_column'), 'type' => 'VARCHAR', 'size' => 255));
     }
 }
开发者ID:marcj,项目名称:change-logger-behavior,代码行数:12,代码来源:ChangeLoggerBehavior.php


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