1

I'm new to PHP and Postgres. I was wondering what is the best way to create a class from a database table?

For example, I have a table with columns ID, First, Last, Middle

What is the nest approach to have a class Person that has a method, load_by_id that will load all properties of the matched row. This way I can retrieve the properties executing $person->first etc. Does this all have to be created manually within the class or is there an automagic approach?

Cœur
  • 34,719
  • 24
  • 185
  • 251
KingKongFrog
  • 13,298
  • 19
  • 67
  • 121

0 Answers0