Хочется глобально для всех полей типа number установить русский формат десятичного разделителя (,).
Прописал в конфиге
Код: Выделить всё
'i18n' => [
'translations' => [
'*' => [
'sourceLanguage' => 'ru-RU',
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@app/messages',
'fileMap' => [
'app' => 'app.php',
'app/error' => 'error.php',
],
],
],
],
'formatter' => [
'class' => 'yii\i18n\Formatter',
'nullDisplay' => '',
'dateFormat' => 'dd.MM.yyyy',
'locale' => 'ru',
'decimalSeparator' => ',',
'thousandSeparator' => ' ',
],
'container' => [
'definitions' => [
yii\validators\NumberValidator::className() => [
'numberPattern' => '/^\s*[-+]?[0-9]*\,?[0-9]+([eE][-+]?[0-9]+)?\s*$/'
]
]
]
Код: Выделить всё
....
foreach ($columns as $name => $value) {
$value = isset($columnSchemas[$name]) ? $columnSchemas[$name]->dbTypecast($value) : $value;
...
}