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