CateMap.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace addons\TinyShop\common\models\product;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%addon_tiny_shop_product_cate_map}}".
  6. *
  7. * @property int|null $cate_id 分类id
  8. * @property int|null $product_id 商品id
  9. * @property int|null $merchant_id 商户id
  10. */
  11. class CateMap extends \yii\db\ActiveRecord
  12. {
  13. /**
  14. * {@inheritdoc}
  15. */
  16. public static function tableName()
  17. {
  18. return '{{%addon_tiny_shop_product_cate_map}}';
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function rules()
  24. {
  25. return [
  26. [['cate_id', 'product_id', 'merchant_id'], 'integer'],
  27. ];
  28. }
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public function attributeLabels()
  33. {
  34. return [
  35. 'cate_id' => '分类id',
  36. 'product_id' => '商品id',
  37. 'merchant_id' => '商户id',
  38. ];
  39. }
  40. /**
  41. * 关联分类
  42. *
  43. * @return \yii\db\ActiveQuery
  44. */
  45. public function getCate()
  46. {
  47. return $this->hasOne(Cate::class, ['id' => 'cate_id'])->select(['id', 'title']);
  48. }
  49. }
粤ICP备19079148号