Browse Source

Ajout champs id_subscription à la table order

dev
Guillaume Bourgeois 6 years ago
parent
commit
a1d742c027
2 changed files with 23 additions and 1 deletions
  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 View File

* @property integer $id_point_sale * @property integer $id_point_sale
* @property integer $id_distribution * @property integer $id_distribution
* @property boolean $auto_payment * @property boolean $auto_payment
* @property integer $id_subscription
*/ */
class Order extends ActiveRecordCommon class Order extends ActiveRecordCommon
{ {
{ {
return [ return [
[['id_user', 'date', 'id_point_sale', 'id_distribution'], 'required', 'message' => ''], [['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'], [['auto_payment'], 'boolean'],
[['date', 'date_update', 'comment', 'comment_point_sale'], 'safe'] [['date', 'date_update', 'comment', 'comment_point_sale'], 'safe']
]; ];
'date_update' => 'Date de modification', 'date_update' => 'Date de modification',
'id_point_sale' => 'Point de vente', 'id_point_sale' => 'Point de vente',
'id_distribution' => 'Date de distribution', 'id_distribution' => 'Date de distribution',
'id_subscription' => 'Abonnement',
]; ];
} }


{ {
return $this->hasMany(CreditHistory::className(), ['id_order' => 'id']); 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. * Retourne les options de base nécessaires à la fonction de recherche.

+ 14
- 0
console/migrations/m190109_080828_add_field_subscription_order.php View File

<?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') ;
}
}

Loading…
Cancel
Save