Example #1
0
 /**
  * IDオプションを設定する
  *
  * @param  Table $table
  * @param  string $column_name primary_keyを指定するカラム名
  * @return Table
  **/
 private function _buildIdOption(Table $table, $column_name = 'id')
 {
     $columns = $table->getColumns();
     $column = new Column();
     $column->setName($column_name)->setType('integer')->setIdentity(true);
     array_unshift($columns, $column);
     $table->setColumns($columns);
     $options = $table->getOptions();
     $options['primary_key'] = $column_name;
     $table->setOptions($options);
     return $table;
 }