|
- <?php
-
- namespace domain\Distribution\DistributionRotating;
-
- use common\components\ActiveRecordCommon;
- use domain\Distribution\Distribution\Distribution;
- use domain\Product\Rotating\Rotating;
- use domain\Product\RotatingProduct\RotatingProduct;
- use yii\db\ActiveQuery;
-
- class DistributionRotating extends ActiveRecordCommon
- {
- public static function tableName()
- {
- return 'distribution_rotating';
- }
-
- public function rules()
- {
- return [
- [['id_distribution', 'id_rotating'], 'required'],
- [['id_distribution', 'id_rotating', 'id_rotating_product', 'status'], 'integer'],
- ];
- }
-
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'id_distribution' => 'Distribution',
- 'id_rotating' => 'Produit tournant',
- 'id_rotating_product' => 'Produit',
- 'status' => 'Statut',
- ];
- }
-
- /* Getters / Setters */
-
- public function getDistribution(): Distribution
- {
- return $this->distributionRelation;
- }
-
- public function setDistribution(Distribution $distribution): self
- {
- $this->populateFieldObject('id_distribution', 'distributionRelation', $distribution);
- return $this;
- }
-
- public function getRotating(): Rotating
- {
- return $this->rotatingRelation;
- }
-
- public function setRotating(Rotating $rotating): self
- {
- $this->populateFieldObject('id_rotating', 'rotatingRelation', $rotating);
- return $this;
- }
-
- public function getRotatingProduct(): RotatingProduct
- {
- return $this->rotatingProductRelation;
- }
-
- public function setRotatingProduct(RotatingProduct $rotatingProduct): self
- {
- $this->populateFieldObject('id_rotating_product', 'rotatingProductRelation', $rotatingProduct);
- return $this;
- }
-
- public function getStatus(): int
- {
- return $this->status;
- }
-
- public function setStatus(int $status): self
- {
- $this->status = $status;
- return $this;
- }
-
- /* Relations */
-
- public function getDistributionRelation(): ActiveQuery
- {
- return $this->hasOne(Distribution::class, ['id' => 'id_distribution']);
- }
-
- public function getRotatingRelation(): ActiveQuery
- {
- return $this->hasOne(Rotating::class, ['id' => 'id_rotating']);
- }
-
- public function getRotatingProductRelation(): ActiveQuery
- {
- return $this->hasOne(RotatingProduct::class, ['id' => 'id_rotating_product']);
- }
- }
|