You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

OrderStatusHistory.php 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace common\logic\Order\OrderStatusHistory\Model;
  3. use common\components\ActiveRecordCommon;
  4. use common\logic\Order\Order\Model\Order;
  5. use common\logic\User\User\Model\User;
  6. /**
  7. * This is the model class for table "order_status_history".
  8. */
  9. class OrderStatusHistory extends ActiveRecordCommon
  10. {
  11. /**
  12. * @inheritdoc
  13. */
  14. public static function tableName()
  15. {
  16. return 'order_status_history';
  17. }
  18. /**
  19. * @inheritdoc
  20. */
  21. public function rules()
  22. {
  23. return [
  24. [['id_order', 'status', 'id_user', 'date', 'origin'], 'required'],
  25. [['id_order', 'id_user',], 'integer'],
  26. [['date'], 'safe'],
  27. ];
  28. }
  29. /**
  30. * @inheritdoc
  31. */
  32. public function attributeLabels()
  33. {
  34. return [
  35. 'id' => 'ID',
  36. 'id_order' => 'Commande',
  37. 'id_user' => 'Utilisateur',
  38. 'status' => 'Statut',
  39. 'origin' => 'Origine',
  40. 'date' => 'Date',
  41. ];
  42. }
  43. /*
  44. * Relations
  45. */
  46. public function getOrder()
  47. {
  48. return $this->hasOne(Order::class, ['id' => 'id_order']);
  49. }
  50. public function populateOrder(Order $order): void
  51. {
  52. $this->populateFieldObject('id_order', 'order', $order);
  53. }
  54. public function getUser()
  55. {
  56. return $this->hasOne(User::class, ['id' => 'id_user']);
  57. }
  58. public function populateUser(User $user): void
  59. {
  60. $this->populateFieldObject('id_user', 'user', $user);
  61. }
  62. }