Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename date columns #12

Merged
merged 2 commits into from
Apr 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}
}