浏览代码

Ajout champs id_subscription à la table order

refactoring
父节点
当前提交
a1d742c027
共有 2 个文件被更改,包括 23 次插入1 次删除
  1. +9
    -1
      common/models/Order.php
  2. +14
    -0
      console/migrations/m190109_080828_add_field_subscription_order.php

+ 9
- 1
common/models/Order.php 查看文件

@@ -53,6 +53,7 @@ use common\components\ActiveRecordCommon ;
* @property integer $id_point_sale
* @property integer $id_distribution
* @property boolean $auto_payment
* @property integer $id_subscription
*/
class Order extends ActiveRecordCommon
{
@@ -92,7 +93,7 @@ class Order extends ActiveRecordCommon
{
return [
[['id_user', 'date', 'id_point_sale', 'id_distribution'], 'required', 'message' => ''],
[['id_user', 'id_point_sale', 'id_distribution'], 'integer'],
[['id_user', 'id_point_sale', 'id_distribution','id_subscription'], 'integer'],
[['auto_payment'], 'boolean'],
[['date', 'date_update', 'comment', 'comment_point_sale'], 'safe']
];
@@ -110,6 +111,7 @@ class Order extends ActiveRecordCommon
'date_update' => 'Date de modification',
'id_point_sale' => 'Point de vente',
'id_distribution' => 'Date de distribution',
'id_subscription' => 'Abonnement',
];
}

@@ -144,6 +146,12 @@ class Order extends ActiveRecordCommon
{
return $this->hasMany(CreditHistory::className(), ['id_order' => 'id']);
}
public function getSubscription()
{
return $this->hasOne(Subscription::className(), ['id' => 'id_subscription'])
->with('productSubscription');
}

/**
* Retourne les options de base nécessaires à la fonction de recherche.

+ 14
- 0
console/migrations/m190109_080828_add_field_subscription_order.php 查看文件

@@ -0,0 +1,14 @@
<?php

use yii\db\Migration;

class m190109_080828_add_field_subscription_order extends Migration {

public function up() {
$this->addColumn('order', 'id_subscription', Schema::TYPE_INTEGER) ;
}

public function down() {
$this->dropColumn('order', 'id_subscription') ;
}
}

正在加载...
取消
保存