Skip to content

Commit

Permalink
Merge pull request #12 from yii2mod/rename_date_columns
Browse files Browse the repository at this point in the history
rename date columns
  • Loading branch information
Igor Chepurnoy authored Apr 13, 2017
2 parents 0bdf4cb + 3f31897 commit 5221f62
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 22 deletions.
4 changes: 2 additions & 2 deletions messages/de/yii2mod.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
'Value' => 'Wert',
'Status' => 'Status',
'Description' => 'Beschreibung',
'Created date' => 'Erstellungsdatum',
'Updated date' => 'Änderungsdatum',
'Created Date' => 'Erstellungsdatum',
'Updated Date' => 'Änderungsdatum',
'Settings' => 'Einstellungen',
'Create Setting' => 'Einstellung hinzufügen',
'Select Type' => 'Typ auswählen',
Expand Down
4 changes: 2 additions & 2 deletions messages/en/yii2mod.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
'Value' => 'Value',
'Status' => 'Status',
'Description' => 'Description',
'Created date' => 'Created date',
'Updated date' => 'Updated date',
'Created Date' => 'Created Date',
'Updated Date' => 'Updated Date',
'Settings' => 'Settings',
'Create Setting' => 'Create Setting',
'Select Type' => 'Select Type',
Expand Down
4 changes: 2 additions & 2 deletions messages/ru/yii2mod.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
'Value' => 'Значение',
'Status' => 'Статус',
'Description' => 'Описание',
'Created date' => 'Дата создания',
'Updated date' => 'Дата обновления',
'Created Date' => 'Дата Создания',
'Updated Date' => 'Дата Обновления',
'Settings' => 'Настройки',
'Create Setting' => 'Создать Настройку',
'Select Type' => 'Выберите Тип',
Expand Down
4 changes: 2 additions & 2 deletions messages/uk/yii2mod.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
'Value' => 'Значення',
'Status' => 'Статус',
'Description' => 'Опис',
'Created date' => 'Дата створення',
'Updated date' => 'Дата поновлення',
'Created Date' => 'Дата Створення',
'Updated Date' => 'Дата Поновлення',
'Settings' => 'Налаштування',
'Create Setting' => 'Створити Налаштування',
'Select Type' => 'Виберіть Тип',
Expand Down
29 changes: 29 additions & 0 deletions migrations/m170413_125133_rename_date_columns.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

use yii\db\Migration;

class m170413_125133_rename_date_columns extends Migration
{
public function up()
{
$this->renameColumn('{{%setting}}', 'createdAt', 'created_at');
$this->renameColumn('{{%setting}}', 'updatedAt', 'updated_at');
}

public function down()
{
$this->renameColumn('{{%setting}}', 'created_at', 'createdAt');
$this->renameColumn('{{%setting}}', 'updated_at', 'updatedAt');
}

/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
16 changes: 6 additions & 10 deletions models/SettingModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use yii2mod\settings\models\enumerables\SettingType;

/**
* This is the model class for table "Settings".
* This is the model class for table "{{%setting}}".
*
* @property int $id
* @property string $type
Expand All @@ -19,8 +19,8 @@
* @property string $value
* @property bool $status
* @property string $description
* @property string $createdAt
* @property string $updatedAt
* @property string $created_at
* @property string $updated_at
*/
class SettingModel extends ActiveRecord
{
Expand Down Expand Up @@ -62,8 +62,8 @@ public function attributeLabels()
'value' => Yii::t('yii2mod.settings', 'Value'),
'status' => Yii::t('yii2mod.settings', 'Status'),
'description' => Yii::t('yii2mod.settings', 'Description'),
'createdAt' => Yii::t('yii2mod.settings', 'Created date'),
'updatedAt' => Yii::t('yii2mod.settings', 'Updated date'),
'created_at' => Yii::t('yii2mod.settings', 'Created Date'),
'updated_at' => Yii::t('yii2mod.settings', 'Updated Date'),
];
}

Expand All @@ -73,11 +73,7 @@ public function attributeLabels()
public function behaviors()
{
return [
'timestamp' => [
'class' => TimestampBehavior::class,
'createdAtAttribute' => 'createdAt',
'updatedAtAttribute' => 'updatedAt',
],
TimestampBehavior::class,
];
}

Expand Down
4 changes: 2 additions & 2 deletions models/search/SettingSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ public function rules()
/**
* Creates data provider instance with search query applied
*
* @param $params
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
public function search(array $params)
{
$query = self::find();

Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ protected function setupTestDbData()
'value' => 'text not null',
'status' => 'smallint not null default 1',
'description' => 'string',
'createdAt' => 'integer not null',
'updatedAt' => 'integer not null',
'created_at' => 'integer not null',
'updated_at' => 'integer not null',
])->execute();
}
}

0 comments on commit 5221f62

Please sign in to comment.