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
  • 37,241
  • 25
  • 195
  • 267
KingKongFrog
  • 13,946
  • 21
  • 75
  • 124

0 Answers0