當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Table::dropColumn方法代碼示例

本文整理匯總了PHP中Doctrine\DBAL\Schema\Table::dropColumn方法的典型用法代碼示例。如果您正苦於以下問題:PHP Table::dropColumn方法的具體用法?PHP Table::dropColumn怎麽用?PHP Table::dropColumn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\DBAL\Schema\Table的用法示例。


在下文中一共展示了Table::dropColumn方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testDropColumn

 public function testDropColumn()
 {
     $type = Type::getType('integer');
     $columns = array();
     $columns[] = new Column("foo", $type);
     $columns[] = new Column("bar", $type);
     $table = new Table("foo", $columns, array(), array());
     $this->assertTrue($table->hasColumn("foo"));
     $this->assertTrue($table->hasColumn("bar"));
     $table->dropColumn("foo")->dropColumn("bar");
     $this->assertFalse($table->hasColumn("foo"));
     $this->assertFalse($table->hasColumn("bar"));
 }
開發者ID:dracony,項目名稱:forked-php-orm-benchmark,代碼行數:13,代碼來源:TableTest.php

示例2: dropColumn

 /**
  * @param $column
  *
  * @return Blueprint
  */
 public function dropColumn($column)
 {
     return $this->table->dropColumn($column);
 }
開發者ID:nikolajlovenhardt,項目名稱:migrations,代碼行數:9,代碼來源:Table.php

示例3: dropColumn

 /**
  * Drops a column from table.
  *
  * @param $columnName
  */
 public function dropColumn($columnName)
 {
     if ($this->checkColumnExists($columnName)) {
         $this->toTable->dropColumn($columnName);
     }
 }
開發者ID:dongilbert,項目名稱:mautic,代碼行數:11,代碼來源:ColumnSchemaHelper.php

示例4: testNormalizesColumnNames

 /**
  * @dataProvider getNormalizesAssetNames
  * @group DBAL-831
  */
 public function testNormalizesColumnNames($assetName)
 {
     $table = new Table('test');
     $table->addColumn($assetName, 'integer');
     $table->addIndex(array($assetName), $assetName);
     $table->addForeignKeyConstraint('test', array($assetName), array($assetName), array(), $assetName);
     $this->assertTrue($table->hasColumn($assetName));
     $this->assertTrue($table->hasColumn('foo'));
     $this->assertInstanceOf('Doctrine\\DBAL\\Schema\\Column', $table->getColumn($assetName));
     $this->assertInstanceOf('Doctrine\\DBAL\\Schema\\Column', $table->getColumn('foo'));
     $this->assertTrue($table->hasIndex($assetName));
     $this->assertTrue($table->hasIndex('foo'));
     $this->assertInstanceOf('Doctrine\\DBAL\\Schema\\Index', $table->getIndex($assetName));
     $this->assertInstanceOf('Doctrine\\DBAL\\Schema\\Index', $table->getIndex('foo'));
     $this->assertTrue($table->hasForeignKey($assetName));
     $this->assertTrue($table->hasForeignKey('foo'));
     $this->assertInstanceOf('Doctrine\\DBAL\\Schema\\ForeignKeyConstraint', $table->getForeignKey($assetName));
     $this->assertInstanceOf('Doctrine\\DBAL\\Schema\\ForeignKeyConstraint', $table->getForeignKey('foo'));
     $table->renameIndex($assetName, $assetName);
     $this->assertTrue($table->hasIndex($assetName));
     $this->assertTrue($table->hasIndex('foo'));
     $table->renameIndex($assetName, 'foo');
     $this->assertTrue($table->hasIndex($assetName));
     $this->assertTrue($table->hasIndex('foo'));
     $table->renameIndex('foo', $assetName);
     $this->assertTrue($table->hasIndex($assetName));
     $this->assertTrue($table->hasIndex('foo'));
     $table->renameIndex($assetName, 'bar');
     $this->assertFalse($table->hasIndex($assetName));
     $this->assertFalse($table->hasIndex('foo'));
     $this->assertTrue($table->hasIndex('bar'));
     $table->renameIndex('bar', $assetName);
     $table->dropColumn($assetName);
     $table->dropIndex($assetName);
     $table->removeForeignKey($assetName);
     $this->assertFalse($table->hasColumn($assetName));
     $this->assertFalse($table->hasColumn('foo'));
     $this->assertFalse($table->hasIndex($assetName));
     $this->assertFalse($table->hasIndex('foo'));
     $this->assertFalse($table->hasForeignKey($assetName));
     $this->assertFalse($table->hasForeignKey('foo'));
 }
開發者ID:selimcr,項目名稱:servigases,代碼行數:46,代碼來源:TableTest.php


注:本文中的Doctrine\DBAL\Schema\Table::dropColumn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。