views:

167

answers:

2

The API gives the code as:

public function up()
{
    $this->addColumn('table_name', 'column_name', 'string', $options);
}

but there's no documentation for what can be included in the options array.

http://www.doctrine-project.org/Doctrine_Migration_Base/1_2#method_addcolumn

A: 

Following the "browse code" link on the top, you can follow the code to $options['length'] in Doctrine_Migration_Base::column() and the second parameter in Doctrine_Migration_Base::_addChange(). Check out the source code from time to time, it gives you an overview :)

chelmertz
I scoured through their code because the doc is lacking but still haven't found any options or what Doctrine would allow as options. When I try to add 'length' of 128 or 'notnull' as true, those values are ignored.
rxgx
+1  A: 

The documentation is wrong. Looking in Doctrine/Migration/base.php, you can see the following function prototype:

/** * 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())

So to add the length, you give it as the 4th parameter. I'm ignoring the options for the moment.

Dan Smart