您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

99 行
2.5KB

  1. <?php
  2. namespace domain\Distribution\DistributionRotating;
  3. use common\components\ActiveRecordCommon;
  4. use domain\Distribution\Distribution\Distribution;
  5. use domain\Product\Rotating\Rotating;
  6. use domain\Product\RotatingProduct\RotatingProduct;
  7. use yii\db\ActiveQuery;
  8. class DistributionRotating extends ActiveRecordCommon
  9. {
  10. public static function tableName()
  11. {
  12. return 'distribution_rotating';
  13. }
  14. public function rules()
  15. {
  16. return [
  17. [['id_distribution', 'id_rotating'], 'required'],
  18. [['id_distribution', 'id_rotating', 'id_rotating_product', 'status'], 'integer'],
  19. ];
  20. }
  21. public function attributeLabels()
  22. {
  23. return [
  24. 'id' => 'ID',
  25. 'id_distribution' => 'Distribution',
  26. 'id_rotating' => 'Produit tournant',
  27. 'id_rotating_product' => 'Produit',
  28. 'status' => 'Statut',
  29. ];
  30. }
  31. /* Getters / Setters */
  32. public function getDistribution(): Distribution
  33. {
  34. return $this->distributionRelation;
  35. }
  36. public function setDistribution(Distribution $distribution): self
  37. {
  38. $this->populateFieldObject('id_distribution', 'distributionRelation', $distribution);
  39. return $this;
  40. }
  41. public function getRotating(): Rotating
  42. {
  43. return $this->rotatingRelation;
  44. }
  45. public function setRotating(Rotating $rotating): self
  46. {
  47. $this->populateFieldObject('id_rotating', 'rotatingRelation', $rotating);
  48. return $this;
  49. }
  50. public function getRotatingProduct(): RotatingProduct
  51. {
  52. return $this->rotatingProductRelation;
  53. }
  54. public function setRotatingProduct(RotatingProduct $rotatingProduct): self
  55. {
  56. $this->populateFieldObject('id_rotating_product', 'rotatingProductRelation', $rotatingProduct);
  57. return $this;
  58. }
  59. public function getStatus(): int
  60. {
  61. return $this->status;
  62. }
  63. public function setStatus(int $status): self
  64. {
  65. $this->status = $status;
  66. return $this;
  67. }
  68. /* Relations */
  69. public function getDistributionRelation(): ActiveQuery
  70. {
  71. return $this->hasOne(Distribution::class, ['id' => 'id_distribution']);
  72. }
  73. public function getRotatingRelation(): ActiveQuery
  74. {
  75. return $this->hasOne(Rotating::class, ['id' => 'id_rotating']);
  76. }
  77. public function getRotatingProductRelation(): ActiveQuery
  78. {
  79. return $this->hasOne(RotatingProduct::class, ['id' => 'id_rotating_product']);
  80. }
  81. }