Replace q() call with Profile::get() method

This commit is contained in:
Philipp Holzer 2019-07-26 15:53:57 +02:00
parent 6c2cf494b5
commit 2a87464c97
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
2 changed files with 52 additions and 38 deletions

View file

@ -45,6 +45,25 @@ class Profile
return $profile;
}
/**
* @brief Returns the profile based on a ID
*
* @param int $uid The User ID
* @param int $id The id of the profile (optional)
* @param array $fields The fields to retrieve
*
* @return array Array of profile data
* @throws \Exception
*/
public static function get(int $uid, int $id = null, array $fields = [])
{
if (empty($id)) {
return DBA::select('profile', $fields, ['uid' => $uid]);
} else {
return DBA::select('profile', $fields, ['uid' => $uid, 'id' => $id]);
}
}
/**
* @brief Returns a formatted location string from the given profile array
*