Since: 2.0
Author: Qiang Xue (qiang.xue@gmail.com)
Inheritance: extends yii\base\Object
 protected function typecast($value)
 {
     $value = parent::typecast($value);
     if ($this->case !== false && is_string($value)) {
         if ($this->case === CASE_LOWER) {
             $value = strtolower($value);
         } elseif ($this->case === CASE_UPPER) {
             $value = strtoupper($value);
         }
     }
     return utf8_encode($value);
 }
Ejemplo n.º 2
0
 /**
  * Extracts the default value for the column.
  * The value is typecasted to correct PHP type.
  * @param mixed the default value obtained from metadata
  */
 protected function extractDefault($defaultValue)
 {
     /*
      * handle CURRENT_DATE/TIME/TIMESTAMP with optional precision
      * @todo handle context variable 'NOW'
      * ref. http://www.firebirdsql.org/refdocs/langrefupd25-variables.html
      */
     if (preg_match('/(CURRENT_|NULL|TODAY|TOMORROW|YESTERDAY)/i', $defaultValue)) {
         $this->defaultValue = null;
     } elseif ($defaultValue == "''") {
         $this->defaultValue = '';
     } else {
         parent::extractDefault($defaultValue);
     }
 }