Skip to content

Commit 5221f62

Browse files
author
Igor Chepurnoy
authored
Merge pull request #12 from yii2mod/rename_date_columns
rename date columns
2 parents 0bdf4cb + 3f31897 commit 5221f62

8 files changed

+47
-22
lines changed

messages/de/yii2mod.settings.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
'Value' => 'Wert',
2525
'Status' => 'Status',
2626
'Description' => 'Beschreibung',
27-
'Created date' => 'Erstellungsdatum',
28-
'Updated date' => 'Änderungsdatum',
27+
'Created Date' => 'Erstellungsdatum',
28+
'Updated Date' => 'Änderungsdatum',
2929
'Settings' => 'Einstellungen',
3030
'Create Setting' => 'Einstellung hinzufügen',
3131
'Select Type' => 'Typ auswählen',

messages/en/yii2mod.settings.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
'Value' => 'Value',
2525
'Status' => 'Status',
2626
'Description' => 'Description',
27-
'Created date' => 'Created date',
28-
'Updated date' => 'Updated date',
27+
'Created Date' => 'Created Date',
28+
'Updated Date' => 'Updated Date',
2929
'Settings' => 'Settings',
3030
'Create Setting' => 'Create Setting',
3131
'Select Type' => 'Select Type',

messages/ru/yii2mod.settings.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
'Value' => 'Значение',
2525
'Status' => 'Статус',
2626
'Description' => 'Описание',
27-
'Created date' => 'Дата создания',
28-
'Updated date' => 'Дата обновления',
27+
'Created Date' => 'Дата Создания',
28+
'Updated Date' => 'Дата Обновления',
2929
'Settings' => 'Настройки',
3030
'Create Setting' => 'Создать Настройку',
3131
'Select Type' => 'Выберите Тип',

messages/uk/yii2mod.settings.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
'Value' => 'Значення',
2525
'Status' => 'Статус',
2626
'Description' => 'Опис',
27-
'Created date' => 'Дата створення',
28-
'Updated date' => 'Дата поновлення',
27+
'Created Date' => 'Дата Створення',
28+
'Updated Date' => 'Дата Поновлення',
2929
'Settings' => 'Налаштування',
3030
'Create Setting' => 'Створити Налаштування',
3131
'Select Type' => 'Виберіть Тип',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
use yii\db\Migration;
4+
5+
class m170413_125133_rename_date_columns extends Migration
6+
{
7+
public function up()
8+
{
9+
$this->renameColumn('{{%setting}}', 'createdAt', 'created_at');
10+
$this->renameColumn('{{%setting}}', 'updatedAt', 'updated_at');
11+
}
12+
13+
public function down()
14+
{
15+
$this->renameColumn('{{%setting}}', 'created_at', 'createdAt');
16+
$this->renameColumn('{{%setting}}', 'updated_at', 'updatedAt');
17+
}
18+
19+
/*
20+
// Use safeUp/safeDown to run migration code within a transaction
21+
public function safeUp()
22+
{
23+
}
24+
25+
public function safeDown()
26+
{
27+
}
28+
*/
29+
}

models/SettingModel.php

+6-10
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use yii2mod\settings\models\enumerables\SettingType;
1111

1212
/**
13-
* This is the model class for table "Settings".
13+
* This is the model class for table "{{%setting}}".
1414
*
1515
* @property int $id
1616
* @property string $type
@@ -19,8 +19,8 @@
1919
* @property string $value
2020
* @property bool $status
2121
* @property string $description
22-
* @property string $createdAt
23-
* @property string $updatedAt
22+
* @property string $created_at
23+
* @property string $updated_at
2424
*/
2525
class SettingModel extends ActiveRecord
2626
{
@@ -62,8 +62,8 @@ public function attributeLabels()
6262
'value' => Yii::t('yii2mod.settings', 'Value'),
6363
'status' => Yii::t('yii2mod.settings', 'Status'),
6464
'description' => Yii::t('yii2mod.settings', 'Description'),
65-
'createdAt' => Yii::t('yii2mod.settings', 'Created date'),
66-
'updatedAt' => Yii::t('yii2mod.settings', 'Updated date'),
65+
'created_at' => Yii::t('yii2mod.settings', 'Created Date'),
66+
'updated_at' => Yii::t('yii2mod.settings', 'Updated Date'),
6767
];
6868
}
6969

@@ -73,11 +73,7 @@ public function attributeLabels()
7373
public function behaviors()
7474
{
7575
return [
76-
'timestamp' => [
77-
'class' => TimestampBehavior::class,
78-
'createdAtAttribute' => 'createdAt',
79-
'updatedAtAttribute' => 'updatedAt',
80-
],
76+
TimestampBehavior::class,
8177
];
8278
}
8379

models/search/SettingSearch.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ public function rules()
3030
/**
3131
* Creates data provider instance with search query applied
3232
*
33-
* @param $params
33+
* @param array $params
3434
*
3535
* @return ActiveDataProvider
3636
*/
37-
public function search($params)
37+
public function search(array $params)
3838
{
3939
$query = self::find();
4040

tests/TestCase.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ protected function setupTestDbData()
107107
'value' => 'text not null',
108108
'status' => 'smallint not null default 1',
109109
'description' => 'string',
110-
'createdAt' => 'integer not null',
111-
'updatedAt' => 'integer not null',
110+
'created_at' => 'integer not null',
111+
'updated_at' => 'integer not null',
112112
])->execute();
113113
}
114114
}

0 commit comments

Comments
 (0)