I am stuck with a very old large website which I need to do some modifications. I can't use or integrate a new MVC framework due to current site is outdated with some custom coding done long time ago.
I am writing custom reflection class for the user table in the database, but I find it easy to work on the model creating when the parameter passed or primary key and populated the member variables , then use them in the code. for example
$user= new User($user_id);
and then if I need the age I can use
if($user->age > 18)
To do this you might say it's easy just create a constructor method and do a select and assign them to the member variables .. however tricky part is
I want to
Even the database table design is changed I want them to be reflected in the coding without altering the code, ie. if we add a new field to the database table I want it to be called using
$user->new_field;without touching the code. (I know Yii can do this but I can't use Yii as I have to write all functionality of the website if I have to move to a framework)
if possible assign them to the member variables with the data type i.e Strings, Int etc reading them from the database
How to build a model base on above (actually constructor method)?