|
- <?php
-
- namespace domain\Product\RotatingProduct;
-
- use common\components\ActiveRecordCommon;
- use domain\Product\Product\Product;
- use domain\Product\Rotating\Rotating;
- use yii\db\ActiveQuery;
-
- class RotatingProduct extends ActiveRecordCommon
- {
- public static function tableName()
- {
- return 'rotating_product';
- }
-
- public function rules()
- {
- return [
- [['id_rotating', 'id_product'], 'required'],
- [['id_rotating', 'id_product', 'position', 'status'], 'integer'],
- ];
- }
-
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'id_rotating' => 'Produit tournant',
- 'id_product' => 'Product',
- 'position' => 'Position',
- 'status' => 'Statut',
- ];
- }
-
- /* Getters / Setters */
-
- public function getId(): ?int
- {
- return $this->id;
- }
-
- public function getRotating(): Rotating
- {
- return $this->rotatingRelation;
- }
-
- public function setRotating(Rotating $rotating): self
- {
- $this->populateFieldObject('id_rotating', 'rotatingRelation', $rotating);
- return $this;
- }
-
- public function getProduct(): Product
- {
- return $this->productRelation;
- }
-
- public function setProduct(Product $product): self
- {
- $this->populateFieldObject('id_product', 'productRelation', $product);
- return $this;
- }
-
- public function getPosition(): int
- {
- return $this->position;
- }
-
- public function setPosition(int $position): self
- {
- $this->position = $position;
- return $this;
- }
-
- public function getStatus(): int
- {
- return $this->status;
- }
-
- public function setStatus(int $status): self
- {
- $this->status = $status;
- return $this;
- }
-
- /* Relations */
-
- public function getRotatingRelation(): ActiveQuery
- {
- return $this->hasOne(Rotating::class, ['id' => 'id_rotating']);
- }
-
- public function getProductRelation(): ActiveQuery
- {
- return $this->hasOne(Product::class, ['id' => 'id_product']);
- }
- }
|