What are the parameters of the Doctrine addColumn () migration method?

The API gives code like:

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

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

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

+3
source share
3 answers

The documentation is incorrect. Looking at 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 ignore the options at the moment.

+1
source

By following the "view code" link at the top, you can follow the code to $options['length']at Doctrine_Migration_Base::column()and the second parameter to Doctrine_Migration_Base::_addChange(). Check the source code from time to time, it gives you an overview :)

0
source

Source: https://habr.com/ru/post/1733264/


All Articles