|
- <?php
-
-
-
- namespace common\models;
-
- use Yii;
-
-
- class ProductOrder extends \yii\db\ActiveRecord
- {
-
-
-
- public static function tableName()
- {
- return 'product_order';
- }
-
-
-
-
- public function getProduct()
- {
- return $this->hasOne(Product::className(), ['id' => 'id_product']);
- }
-
-
-
- public function rules()
- {
- return [
- [['id_order', 'id_product', 'quantity'], 'required'],
- [['id_order', 'id_product'], 'integer'],
- [['quantity'], 'number', 'min' => 0]
- ];
- }
-
-
-
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'id_order' => 'Commande',
- 'id_product' => 'Product',
- 'quantity' => 'Quantité',
- ];
- }
-
- }
|