xhArticleCategory.php 978 B

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