Beispiel #1
0
 public static function getDefaultValueStringProvider()
 {
     $col1 = new Column('Bar');
     $col1->setDomain(new Domain('VARCHAR'));
     $col1->setDefaultValue(new ColumnDefaultValue('abc', ColumnDefaultValue::TYPE_VALUE));
     $val1 = "'abc'";
     $col2 = new Column('Bar');
     $col2->setDomain(new Domain('INTEGER'));
     $col2->setDefaultValue(new ColumnDefaultValue(1234, ColumnDefaultValue::TYPE_VALUE));
     $val2 = "1234";
     $col3 = new Column('Bar');
     $col3->setDomain(new Domain('DATE'));
     $col3->setDefaultValue(new ColumnDefaultValue('0000-00-00', ColumnDefaultValue::TYPE_VALUE));
     $val3 = "NULL";
     return array(array($col1, $val1), array($col2, $val2), array($col3, $val3));
 }
 public function testSetDomain()
 {
     $column = new Column();
     $column->setDomain($this->getDomainMock());
     $this->assertInstanceOf('Propel\\Generator\\Model\\Domain', $column->getDomain());
 }
 protected function addColumn(Table $table, $name)
 {
     if (!$table->hasColumn($name)) {
         $column = new Column($name);
         // don't know how to define unsigned :(
         $domain = new Domain('TINYINT', 'tinyint(3) unsigned');
         $column->setDomain($domain);
         $table->addColumn($column);
         $column_idx_name = $name . '_idx';
         if (!$table->hasIndex($column_idx_name)) {
             $column_idx = new Index($column_idx_name);
             $column_idx->addColumn(['name' => $column->getName()]);
             $table->addIndex($column_idx);
         }
     }
 }