Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

97 lines
2.6KB

  1. <?php
  2. namespace domain\PointSale\SharedPointSale;
  3. use common\components\ActiveRecordCommon;
  4. use domain\PointSale\PointSale\PointSale;
  5. use domain\Producer\Producer\Producer;
  6. class SharedPointSale extends ActiveRecordCommon
  7. {
  8. public function getPointSale(): PointSale
  9. {
  10. return $this->pointSaleRelation;
  11. }
  12. public function setPointSale(PointSale $pointSale): self
  13. {
  14. $this->populateFieldObject('id_point_sale', 'pointSaleRelation', $pointSale);
  15. return $this;
  16. }
  17. public function getProducerWithSharing(): Producer
  18. {
  19. return $this->producerWithSharingRelation;
  20. }
  21. public function setProducerWithSharing(Producer $producerWithSharing): self
  22. {
  23. $this->populateFieldObject('id_producer_with_sharing', 'producerWithSharingRelation', $producerWithSharing);
  24. return $this;
  25. }
  26. public function getPointSaleWithSharing(): ?PointSale
  27. {
  28. return $this->pointSaleWithSharing;
  29. }
  30. public function setPointSaleWithSharing(PointSale $pointSaleWithSharing = null): self
  31. {
  32. if($pointSaleWithSharing) {
  33. $this->populateFieldObject('id_point_sale_with_sharing', 'pointSaleWithSharingRelation', $pointSaleWithSharing);
  34. }
  35. return $this;
  36. }
  37. public function getStatus(): int
  38. {
  39. return $this->status;
  40. }
  41. public function setStatus(int $status): self
  42. {
  43. $this->status = $status;
  44. return $this;
  45. }
  46. public static function tableName()
  47. {
  48. return 'shared_point_sale';
  49. }
  50. public function rules()
  51. {
  52. return [
  53. [['id_point_sale', 'id_producer_with_sharing'], 'required'],
  54. [['id_point_sale', 'id_producer_with_sharing', 'id_point_sale_with_sharing', 'status'], 'integer'],
  55. ];
  56. }
  57. public function attributeLabels()
  58. {
  59. return [
  60. 'id_point_sale' => 'Point de vente que vous souhaitez partager',
  61. 'id_producer_with_sharing' => 'Producteur avec qui vous souhaitez partager un point de vente',
  62. 'id_point_sale_with_sharing' => 'Point de vente du producteur avec qui vous souhaitez partager un point de vente',
  63. ];
  64. }
  65. /* Relations */
  66. public function getPointSaleRelation()
  67. {
  68. return $this->hasOne(PointSale::class, ['id' => 'id_point_sale']);
  69. }
  70. public function getProducerWithSharingRelation()
  71. {
  72. return $this->hasOne(Producer::class, ['id' => 'id_producer_with_sharing']);
  73. }
  74. public function getPointSaleWithSharingRelation()
  75. {
  76. return $this->hasOne(PointSale::class, ['id' => 'id_point_sale_with_sharing']);
  77. }
  78. }