ValetOrderDefaultUser.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace addons\ValetOrder\common\models;
  3. use RuntimeException;
  4. use Yii;
  5. /**
  6. * This is the model class for table "qimall_addons_valet_order_default_user".
  7. *
  8. * @property int $id
  9. * @property int $mall_id
  10. * @property int $user_id
  11. * @property int $created_at
  12. * @property int $updated_at
  13. */
  14. class ValetOrderDefaultUser extends \common\models\base\BaseActiveRecord
  15. {
  16. /**
  17. * {@inheritdoc}
  18. */
  19. public static function tableName()
  20. {
  21. return 'qimall_addons_valet_order_default_user';
  22. }
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function rules()
  27. {
  28. return [
  29. [['mall_id', 'user_id', 'created_at', 'updated_at'], 'integer'],
  30. ];
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function attributeLabels()
  36. {
  37. return [
  38. 'id' => 'ID',
  39. 'mall_id' => 'Mall ID',
  40. 'user_id' => 'User ID',
  41. 'created_at' => 'Created At',
  42. 'updated_at' => 'Updated At',
  43. ];
  44. }
  45. /**
  46. * @param array $data
  47. *
  48. * @return false|self
  49. */
  50. public static function setData(array $data)
  51. {
  52. $model = new self();
  53. $model->loadDefaultValues();
  54. if (!$model->load($data, '')) {
  55. return false;
  56. }
  57. if (!$model->save()) {
  58. return false;
  59. }
  60. return $model;
  61. }
  62. }