Skip to content
Advertisement

Object-Relational Mapping vs Database Abstraction Layer

I’m using Doctrine which provides both ORM and DBAL.

What is difference between them?

How should one decide when to use which?

Advertisement

Answer

The DBAL (DataBase Abstraction Layer) is a piece of software that simplifies interaction with SQL databases, by allowing you to use them without worrying about the specific dialects or differences of the different DBMS vendors. It basically allows you to run SQL queries against the DBMS without writing vendor specific SQL.

The ORM (Object Relational Mapper) is a tool that gives you the impression of working with an in-memory data structure represented as an object graph with associated objects. It simplifies application logic related with SQL operations by removing all the SQL and abstracting it into OOP logic. Doctrine 2 ORM simply handles loading and persisting of POPO (Plain Old PHP Objects).

You can find more about this topic on the DBAL documentation and the ORM documentation.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement