AttrGroup.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use Yii;
  9. /**
  10. * This is the model class for table "{{%attr_group}}".
  11. *
  12. * @property integer $id
  13. * @property integer $store_id
  14. * @property string $attr_group_name
  15. * @property integer $is_delete
  16. */
  17. class AttrGroup extends \yii\db\ActiveRecord
  18. {
  19. /**
  20. * @inheritdoc
  21. */
  22. public static function tableName()
  23. {
  24. return '{{%attr_group}}';
  25. }
  26. /**
  27. * @inheritdoc
  28. */
  29. public function rules()
  30. {
  31. return [
  32. [['store_id', 'attr_group_name'], 'required'],
  33. [['store_id', 'is_delete'], 'integer'],
  34. [['attr_group_name'], 'string', 'max' => 255],
  35. ];
  36. }
  37. /**
  38. * @inheritdoc
  39. */
  40. public function attributeLabels()
  41. {
  42. return [
  43. 'id' => 'ID',
  44. 'store_id' => 'Store ID',
  45. 'attr_group_name' => 'Attr Group Name',
  46. 'is_delete' => 'Is Delete',
  47. ];
  48. }
  49. private $attrList;
  50. public function getAttrList()
  51. {
  52. if ($this->attrList) {
  53. return $this->attrList;
  54. }
  55. $this->attrList = Attr::findAll(['is_delete' => 0, 'attr_group_id' => $this->id]);
  56. return $this->attrList;
  57. }
  58. }