|
- <?php
-
-
-
- namespace common\models;
-
- use Yii;
- use common\models\Product;
- use common\components\ActiveRecordCommon ;
-
-
- class ProductSubscription extends ActiveRecordCommon
- {
-
-
-
- public static function tableName()
- {
- return 'product_subscription';
- }
-
-
-
- public function rules()
- {
- return [
- [['id_subscription', 'id_product'], 'required'],
- [['id_subscription', 'id_product'], 'integer'],
- [['quantity'], 'number'],
- ];
- }
-
-
-
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'id_subscription' => 'Abonnement',
- 'id_product' => 'Produit',
- 'quantity' => 'Quantité',
- ];
- }
-
-
-
-
- public function getProduct()
- {
- return $this->hasOne(Product::className(), ['id' => 'id_product']);
- }
-
-
-
- public static function defaultOptionsSearch() {
- return [
- 'with' => ['product'],
- 'join_with' => [],
- 'orderby' => '',
- 'attribute_id_producer' => ''
- ] ;
- }
-
- }
|