xhGoodsCategory.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace common\models;
  3. /**
  4. * This is the model class for table "xhGoodsCategory".
  5. *
  6. * @property integer $id
  7. * @property integer $gId
  8. * @property integer $cId
  9. * @property integer $merchantId
  10. * @property integer $inTurn
  11. */
  12. class xhGoodsCategory extends xhBaseModel
  13. {
  14. /**
  15. * @inheritdoc
  16. */
  17. public static function tableName()
  18. {
  19. return 'xhGoodsCategory';
  20. }
  21. /**
  22. * @inheritdoc
  23. */
  24. public function rules()
  25. {
  26. return [
  27. [['gId', 'cId', 'merchantId', 'inTurn'], 'integer'],
  28. ];
  29. }
  30. /**
  31. * @inheritdoc
  32. */
  33. public function attributeLabels()
  34. {
  35. return [
  36. 'id' => 'ID',
  37. 'gId' => 'G ID',
  38. 'cId' => 'C ID',
  39. 'merchantId' => 'Merchant ID',
  40. 'inTurn' => 'In Turn',
  41. ];
  42. }
  43. public function getXhGoods()
  44. {
  45. // 关系和商品通过 Goods.id -> gId 关联建立一对一关系
  46. return $this->hasOne(xhGoods::className(), ['id' => 'gId']);
  47. }
  48. }