ColumnSchema.php 779 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\db\mssql;
  8. /**
  9. * Class ColumnSchema for MSSQL database
  10. *
  11. * @since 2.0.23
  12. */
  13. class ColumnSchema extends \yii\db\ColumnSchema
  14. {
  15. /**
  16. * Prepares default value and converts it according to [[phpType]]
  17. * @param mixed $value default value
  18. * @return mixed converted value
  19. * @since 2.0.24
  20. */
  21. public function defaultPhpTypecast($value)
  22. {
  23. if ($value !== null) {
  24. // convert from MSSQL column_default format, e.g. ('1') -> 1, ('string') -> string
  25. $value = substr(substr($value, 2), 0, -2);
  26. }
  27. return parent::phpTypecast($value);
  28. }
  29. }