本文整理匯總了PHP中Phinx\Db\Table\Column::setOptions方法的典型用法代碼示例。如果您正苦於以下問題:PHP Column::setOptions方法的具體用法?PHP Column::setOptions怎麽用?PHP Column::setOptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Phinx\Db\Table\Column
的用法示例。
在下文中一共展示了Column::setOptions方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: changeColumn
/**
* Change a table column type.
*
* @param string $columnName Column Name
* @param string|Column $newColumnType New Column Type
* @param array $options Options
* @return Table
*/
public function changeColumn($columnName, $newColumnType, $options = array())
{
// create a column object if one wasn't supplied
if (!$newColumnType instanceof Column) {
$newColumn = new Column();
$newColumn->setType($newColumnType);
$newColumn->setOptions($options);
} else {
$newColumn = $newColumnType;
}
// if the name was omitted use the existing column name
if (null === $newColumn->getName() || strlen($newColumn->getName()) === 0) {
$newColumn->setName($columnName);
}
$this->getAdapter()->changeColumn($this->getName(), $columnName, $newColumn);
return $this;
}
示例2: testSetOptionThrowsExceptionIfOptionIsNotString
/**
* @expectedException \RuntimeException
* @expectedExceptionMessage "0" is not a valid column option.
*/
public function testSetOptionThrowsExceptionIfOptionIsNotString()
{
$column = new Column();
$column->setOptions(['identity']);
}
示例3: setOptions
/**
* Utility method that maps an array of column options to this objects methods.
*
* @param array $options Options
*
* @return $this
*/
public function setOptions(array $options)
{
$this->column->setOptions($options);
return $this;
}