/** * @return \yii\db\ActiveQuery */ public function getDocs() { return $this->hasMany(Doc::className(), ['address_id' => 'id']); }
/** * @param null $type_id * @return \yii\db\ActiveQuery */ public function getDocs($type_id = null) { if ($type_id !== null) { return $this->hasMany(Doc::className(), ['person_id' => 'id'])->where('type_id=' . $type_id); } return $this->hasMany(Doc::className(), ['person_id' => 'id']); }