I'm developing a class for my PHP application. The code is being moved into a more OO approach with most of the logic residing in the class. Early on into the development of this, I created individual functions for pulling information from the database:
function getUserID($id) function getMemberID($id) function getUserEmailAddress($id) function getUserFullName($id) function getAnalysisConditionId($id) ... etc. I have lots of functions for pulling out individual field elements from within the database. In fact, I think I have a function for about 50% of the fields in my database. I'm starting to think this is a bit excessive and that this should be done another way.
I thought about building a function (like getUserInfo($id)) and in this function I would query all of the fields in the User table, including any joins related to return all of the relevant fields. I would then return an array of every field in the resulting table. Then if I needed this information somewhere in my application, I could just call it $class->getUserInfo($id)['id'].
Would this be the best way to do this? Should I even make every field available throughout my application? Thanks for your input!