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