P
P
Peter2013-12-26 21:25:08
PHP
Peter, 2013-12-26 21:25:08

How to create columns in Doctrine Schema?

Hello I
continue to understand Silex. I use schem to create tables.
However, I can not find a human description of how to describe the parameters of the columns. All descriptions use yaml, but for some reason there is no description in php.
I mean the following way to create:

if (!$schema->tablesExist('vn_articles')) {
    $vn_articles = new Table('vn_articles');
    $vn_articles->addColumn('id', 'integer', array('autoincrement' => true));
    $vn_articles->setPrimaryKey(array('id'));
    $vn_articles->addColumn('title', 'string');
  }

I want to know how:
a) Set the length? 11 int/ 255 var_char?
b) Allowing NULL values?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
gillbeits, 2013-12-27
@Alcospb

$vn_articles->addColumn('id', 'integer', array( 'length' => 11, 'unsigned' => true ));
$vn_articles->addColumn('title', 'string', array( 'length' => 255, 'notnull' => false));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question