/** * @return \yii\db\ActiveQuery */ public function getSphere() { return $this->hasOne(CompanySphere::className(), ['id' => 'sphere_id']); }
/** * @return \yii\db\ActiveQuery */ public function getSpheres() { return $this->hasMany(CompanySphere::className(), ['id' => 'sphere_id'])->viaTable(CompanyToSphere::tableName(), ['company_id' => 'id'])->from(['cs' => CompanySphere::tableName()]); }