Are you able to, please, explain me the variations between your following database reps, say, in PHP.:

ORM DAO DataMapper ActiveRecord TableGateway

Any good examples could be appreciated.

That will need a pretty lengthy answer. Rather than repeating what others have stated better and in greater detail before me, I link you to definitely some relevant pages. I would recommend to appear through them. Maybe consume a couple of additional links. Wikipedia is usually a good start. If you've still got any queries about either pattern after studying the links, you can return to SO and request again. But when you need to do, attempt to narrow it lower. It's easier to request multiple questions and concentrate on particular aspects than expecting individuals to write an essay for you personally.

Object Relational Mapper

Object-relational mapping (ORM, O/RM, and O/R mapping) in software applications is really a programming way of transforming data between incompatible type systems in relational databases and object-oriented programming languages.

Data Access Object

Make use of a Data Access Object (DAO) to abstract and encapsulate all accessibility databases. The DAO handles the bond using the databases to acquire and store data.


A layer of Mappers (473) that moves data between objects along with a database and keep them separate from one another and also the mapper itself.

Active Record

An item that systems a row inside a database table or view, encapsulates the database access, and adds domain logic on that data.

Table Data Gateway

An item that functions like a Gateway (466) to some database table. One instance handles all of the rows within the table.