I'm researching ways to create a OO-model/repository-layer using PHP's PDO. My idea was to create model classes that represent a domain object and a repository class for each model that has the responsibility of:
- Saving to the database by taking a model as argument and mapping the objects properties to the VALUES of the SQL-query.
- Reading from the database by return an instance of a model in a similar fashion.
I was inspired from a course in OOP in which we used .NET, EF and LINQ for the Labs.
I asked a question on SA about how this could be achived on SA. I got flamed because is is supposedly bad practise.
I don't see why this is the case.