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.

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