コード例 #1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSphere()
 {
     return $this->hasOne(CompanySphere::className(), ['id' => 'sphere_id']);
 }
コード例 #2
0
 /**
  * @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()]);
 }