|
- <?php
-
-
-
- namespace domain\Product\ProductPointSale;
-
- use common\components\ActiveRecordCommon;
- use domain\PointSale\PointSale\PointSale;
- use domain\Product\Product\Product;
-
-
- class ProductPointSale extends ActiveRecordCommon
- {
-
-
- public static function tableName()
- {
- return 'product_point_sale';
- }
-
-
-
- public function rules()
- {
- return [
- [['id_product', 'id_point_sale'], 'required'],
- [['id_product', 'id_point_sale'], 'integer'],
- [['available'], 'boolean'],
- ];
- }
-
-
-
- public function attributeLabels()
- {
- return [
- 'id_product' => 'Produit',
- 'id_point_sale' => 'Point de vente',
- 'available' => 'Disponible',
- ];
- }
-
-
-
-
- public function getProduct()
- {
- return $this->hasOne( Product::class, ['id' => 'id_product']);
- }
-
- public function populateProduct(Product $product): void
- {
- $this->populateFieldObject('id_product', 'product', $product);
- }
-
- public function getPointSale()
- {
- return $this->hasOne(PointSale::class, ['id' => 'id_point_sale']);
- }
-
- public function populatePointSale(PointSale $pointSale): void
- {
- $this->populateFieldObject('id_point_sale', 'pointSale', $pointSale);
- }
- }
|