的API提供的代碼爲:Doctrine的addColumn()遷移方法有哪些選項?
public function up()
{
$this->addColumn('table_name', 'column_name', 'string', $options);
}
,但有什麼可以包含在選項數組中的文檔。
http://www.doctrine-project.org/Doctrine_Migration_Base/1_2#method_addcolumn
的API提供的代碼爲:Doctrine的addColumn()遷移方法有哪些選項?
public function up()
{
$this->addColumn('table_name', 'column_name', 'string', $options);
}
,但有什麼可以包含在選項數組中的文檔。
http://www.doctrine-project.org/Doctrine_Migration_Base/1_2#method_addcolumn
該文檔是錯誤的。展望主義/遷移/ base.php,你可以看到下面的函數原型:
/**
* Add a add column change.
*
* @param string $tableName Name of the table
* @param string $columnName Name of the column
* @param string $type Type of the column
* @param string $length Length of the column
* @param array $options Array of options for the column
* @return void
*/
public function addColumn($tableName, $columnName, $type, $length = null, array $options = array())
所以要加長度,你給它的第四個參數。我忽略了目前的選擇。
繼頂部的「瀏覽代碼」鏈接,你可以按照Doctrine_Migration_Base::column()
代碼$options['length']
和Doctrine_Migration_Base::_addChange()
第二個參數。查看源代碼不時,它給你一個概述:)
對於進來的人來說:它看起來像是真正從數據訪問層定義的。以下是DBAL文檔中列的選項列表:http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/schema-representation.html
這應該是答案 – xorinzor 2016-04-08 13:17:03
我搜遍了他們的代碼,因爲缺少文檔,但仍未找到任何選項或者Doctrine會允許哪些選項。當我嘗試將128或'notnull'的'length'添加爲true時,這些值將被忽略。 – rxgx 2010-03-10 23:02:01