public function init() { $this->attachUserClass(); $this->relationType = static::$relationSingle; $this->multiBlamesClass = FollowGroup::className(); parent::init(); }
/** * Specify groups. * This method will be skipped if not enable the group features (`$multiBlamesAttribute = false`). * @param string|array $groups the guid of group If string, or guid array of * groups if array. If you want to get ungrouped relation(s), please assign * empty array, or if you do not want to delimit group(s), please do not * access this method, or assign null. * @return static $this */ public function groups($groups = []) { if ($groups === null) { return $this; } $model = $this->noInitModel; if (!is_string($model->multiBlamesAttribute)) { return $this; } if (empty($groups)) { return $this->andWhere([$model->multiBlamesAttribute => BaseUserRelationModel::getEmptyGroupJson()]); } return $this->andWhere(['or like', $model->multiBlamesAttribute, $groups]); }