public function setDefault($value) : Column { if ($this->isAutoIncrement()) { throw new ColumnException('Auto increment column can\'t have default value'); } return parent::setDefault($value); }
/** * Create columns */ private function findColumns() { foreach ($this->anns as $annCol) { $name = $annCol->reflector->name; $type = Column::getTypeForProperty($annCol); $column = new Column($name, $type); // other properties that can be given to column if (($val = $annCol->getValue('default', false)) !== false) { $column->setDefault($val); } if ($annCol->getValue('unique', false) !== false) { $column->setAsUnique(); } if ($annCol->getValue('primaryKey', false) !== false) { $column->setAsPrimaryKey(); } if ($annCol->getValue('autoIncrement', false) !== false) { $column->setAsAutoIncrement(); } if ($annCol->getValue('notNull', false) !== false) { $column->allowNull(); } $this->addColumn($column); } }
public function setDefault($value) : Column { if ($value === 'CURRENT_TIMESTAMP') { $this->default_current = true; } return parent::setDefault($value); }