public function actionMydesignerprofilepage() { $model = new Profile(); $designerModel = new DesignerSocialLogin(); $session = new Session(); $session->open(); //$session['user_name'] = 'DummyDesigner1'; //Fetch profile information from DB $prof_info = $model->getProfileInfo($session['user_name']); $imgPath = $prof_info->profile_picture; $name = (new DesignerSocialLogin())->getDesignerInfo($session['user_name']); $endorsement = (new Endorsement())->getUserEndorsementData($session['user_name']); //Update profile image and if not already created, create customer profile if ($model->load(Yii::$app->request->post()) && $model->validate()) { $model->imageFile = UploadedFile::getInstance($model, 'imageFile'); if (isset($model->imageFile->extension)) { $imgPath = 'uploads/profilepictures/' . $session['user_name'] . '_profimg.' . $model->imageFile->extension; $model->imageFile->saveAs($imgPath); $UserProfileExists = (new Profile())->updateCreateProfileForImage($imgPath, $session['user_name']); } } return $this->render('mydesignerprofile', ['model' => $model, 'about' => $prof_info->profile_about, 'imgPath' => $imgPath, 'name' => $name, 'prof_info' => $prof_info, 'endorsement' => $endorsement, 'designerModel' => $designerModel]); }