Hi everyone how can I substitute the findByPk in loadModelb because $id is not Pk and it is a Fk. thanks
public function loadModel($id)
{
$model=Useraccounts::model()->findByPk($id);
if($model===null)
throw new CHttpException(404,'The requested page does not exist.');
return $model;
}
public function loadModelb($id)
{
$modelb=Basicdetails::model()->findByPk($id);
if($modelb==null)
throw new CHttpException(404,'The requested page does not exist.');
return $modelb;
}
{
$criteria=New CDbCritieria;
$critieria->condition='<where Condition>'; //Remove these if not required.
$model=Useraccounts::model()->findByAttributes(array('<fieldname>'=>$id),$criteria);
if($model===null)
throw new CHttpException(404,'The requested page does not exist.');
return $model;
}
public function loadModelb($id)
{
$criteria=New CDbCritieria;
$critieria->condition='<where Condition>'; //Remove these if not required.
$model=Useraccounts::model()->findByAttributes(array('<fieldname>'=>$id),$criteria);
if($modelb==null)
throw new CHttpException(404,'The requested page does not exist.');
return $modelb;
}