What is the difference between ORM and DBAL in Doctrine?
Asked Answered
J

1

34

I'm using Doctrine, which provides both ORM (object relational mapping) and DBAL (database abstraction layer).

What is difference between them?

How should one decide when to use which?

Jacie answered 28/2, 2013 at 4:42 Comment(0)
P
49

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.

Pacifa answered 28/2, 2013 at 9:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.