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.

81 lines
2.0KB

  1. <?php
  2. namespace common\logic\Order\OrderStatusHistory;
  3. use common\components\ActiveRecordCommon;
  4. /**
  5. * This is the model class for table "order_order_status".
  6. *
  7. * @property integer $id
  8. * @property integer $id_order
  9. * @property integer $id_order_status
  10. * @property string $date
  11. */
  12. class OrderStatusHistory extends ActiveRecordCommon
  13. {
  14. /**
  15. * @inheritdoc
  16. */
  17. public static function tableName()
  18. {
  19. return 'order_status_history';
  20. }
  21. /**
  22. * @inheritdoc
  23. */
  24. public function rules()
  25. {
  26. return [
  27. [['id_order', 'status', 'id_user', 'date', 'origin'], 'required'],
  28. [['id_order', 'id_user',], 'integer'],
  29. [['date'], 'safe'],
  30. ];
  31. }
  32. /**
  33. * @inheritdoc
  34. */
  35. public function attributeLabels()
  36. {
  37. return [
  38. 'id' => 'ID',
  39. 'id_order' => 'Commande',
  40. 'id_user' => 'Utilisateur',
  41. 'status' => 'Statut',
  42. 'origin' => 'Origine',
  43. 'date' => 'Date',
  44. ];
  45. }
  46. /*
  47. * Relations
  48. */
  49. public function getOrder()
  50. {
  51. return $this->hasOne( User::className(), ['id' => 'id_order']);
  52. }
  53. public function getUser()
  54. {
  55. return $this->hasOne( User::className(), ['id' => 'id_user']);
  56. }
  57. /**
  58. * Retourne les options de base nécessaires à la fonction de recherche.
  59. *
  60. * @return array
  61. */
  62. public static function defaultOptionsSearch()
  63. {
  64. return [
  65. 'with' => [],
  66. 'join_with' => ['order', 'orderStatus'],
  67. 'orderby' => 'date ASC',
  68. 'attribute_id_producer' => ''
  69. ];
  70. }
  71. }