I have since refactored this code and made the following changes.
This is my rest controller action
public function actionGetUserContactInfo($id)
$user = User::findOne(Yii::$app->user->id);
$user->contact = $user->contactInfo;
This is my model relation
* @return \yii\db\ActiveQuery
public function getContactInfo()
return $this->hasOne(UserContact::className(), ['id' => 'contact']);
I also just found this out, and couldn’t find documentation on it anywhere. I have a property called “contact” in my user model, I should probably have called it “contact_id” but I am merely pointing out what happens when I generated my hasOne relation with the GII tool it named it getContact (as it should), however when accessing that relation according to the docs I came across a problem - using $user->contact (assuming to get my relation) i got my property contact and was returning the int (the one that solves my issue above (sorta)).