What does Doctrine's Database Abstraction Layer offer over simple PDO?
Asked Answered
K

1

6

What do I gain if I use Doctrine's Database Abstraction Layer (DBAL) over simple PDO?

Isn't PDO supposed to be an abstraction layer itself? As far as I can tell, the only benefit I gain is the ability to use Oracle's oci8 driver with a PDO-like API.

What am I missing?

Karren answered 3/4, 2015 at 23:57 Comment(3)
Quite a lot of things, by the looks of it! E.g. fluid query builder, cross-platform schema interrogation, event mechanism, sharding system...Libb
On projects where I only use DBAL the query builder is the biggest thing for me. Custom types also come in very handy.Mayhew
Must've missed that page. Thank you for your answer.Karren
L
3

The benefit of any DB abstraction layer is reducing the number of developer's errors (not only this).

The difference between them, is the level of an abstraction. For example, DBAL built on top of PDO. This means, DBAL should definitely be a bit higher level of abstraction than PDO.

Anyway, both of them are very low level of an abstraction. You should use them only if you have good knowledge of relative DBs. I mean, you should know all types of stored data, and use it right way, also you should have some experience in building of different DB architectures, and know the advantages of every relation type.

If not, I suggest you to use something higher abstracted (Eloquent for example).

PS I know all what I wrote above, but anyway I use the abstraction layer built on top of Eloquent. So, I see the sense of using the highest level of abstraction I have...

Logos answered 11/11, 2017 at 12:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.