Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 866
cesarv Avatar asked Apr 03 '15 23:04

cesarv


1 Answers

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...

like image 166
Piterden Avatar answered Sep 20 '22 16:09

Piterden