public function actionGetMentor($ent_id) { $ent = Entrepreneur::findOne($ent_id); $results = $ent->mentors; foreach ($results as $key => $value) { echo "user_id:" . $value->user_id . "\n"; echo "username:"******"\n"; } }
/** * Finds the Entrepreneur model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Entrepreneur the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Entrepreneur::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }