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?

halfer
  • 19,824
  • 17
  • 99
  • 186
cesarv
  • 87
  • 6
  • 1
    [Quite a lot of things](http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/), by the looks of it! E.g. fluid query builder, cross-platform schema interrogation, event mechanism, sharding system... – halfer Apr 04 '15 at 00:36
  • 1
    On projects where I only use DBAL the query builder is the biggest thing for me. Custom types also come in very handy. – prodigitalson Apr 04 '15 at 02:52
  • Must've missed that page. Thank you for your answer. – cesarv Apr 10 '15 at 15:19

1 Answers1

2

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

Piterden
  • 771
  • 5
  • 17