選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

98 行
2.1KB

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