/** * @inheritdoc */ public function init() { if ($this->logicalFormat === null) { $format = $this->type . 'Format'; $pattern = Yii::$app->formatter->{$format}; } else { $pattern = $this->logicalFormat; } if (substr($pattern, 0, 4) === 'php:') { $this->_phpLogicalFormat = substr($pattern, 4); } else { $this->_phpLogicalFormat = FormatConverter::convertDateIcuToPhp($pattern, $this->type); } if ($this->physicalFormat === null) { $driverName = Yii::$app->db->driverName; if (isset(static::$dbDatetimeFormat[$driverName])) { $pattern = static::$dbDatetimeFormat[$driverName][$this->type]; } else { $pattern = static::$dbDatetimeFormat['default'][$this->type]; } } else { $pattern = $this->physicalFormat; } if (substr($pattern, 0, 4) === 'php:') { $this->_phpPhysicalFormat = substr($pattern, 4); } else { $this->_phpPhysicalFormat = FormatConverter::convertDateIcuToPhp($pattern, $this->type); } parent::init(); }