本文整理汇总了PHP中Propel\Generator\Model\Table::removeColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::removeColumn方法的具体用法?PHP Table::removeColumn怎么用?PHP Table::removeColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel\Generator\Model\Table
的用法示例。
在下文中一共展示了Table::removeColumn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRemoveColumn
public function testRemoveColumn()
{
$column1 = $this->getColumnMock('id');
$column2 = $this->getColumnMock('title');
$column3 = $this->getColumnMock('isbn');
$table = new Table('books');
$table->addColumn($column1);
$table->addColumn($column2);
$table->addColumn($column3);
$table->removeColumn($column2);
$this->assertCount(2, $table->getColumns());
$this->assertTrue($table->hasColumn('id'));
$this->assertTrue($table->hasColumn('isbn'));
$this->assertFalse($table->hasColumn('title'));
}
示例2: testRemoveColumnFixesPositions
public function testRemoveColumnFixesPositions()
{
$table = new Table();
$col1 = new Column('Foo1');
$table->addColumn($col1);
$col2 = new Column('Foo2');
$table->addColumn($col2);
$col3 = new Column('Foo3');
$table->addColumn($col3);
$this->assertEquals(1, $col1->getPosition());
$this->assertEquals(2, $col2->getPosition());
$this->assertEquals(3, $col3->getPosition());
$this->assertEquals(array(0, 1, 2), array_keys($table->getColumns()));
$table->removeColumn($col2);
$this->assertEquals(1, $col1->getPosition());
$this->assertEquals(2, $col3->getPosition());
$this->assertEquals(array(0, 1), array_keys($table->getColumns()));
}