Doctrine DBAL is the most popular relational database abstraction library for PHP. Many developers prefer using a database abstraction since they usually provide a better developer experience than working directly with database drivers. However, despite the best effort of their designers, abstractions often make developers unhappy when it comes to using non-trivial database features.

Per Joel Spolsky[1], "all non-trivial abstractions, to some degree, are leaky". As a quite complex one, Doctrine DBAL leaks in a variety of aspects: drivers, SQL dialects, and schema management specifics.

In this talk, I will highlight the most notable inconsistencies of Doctrine DBAL APIs and provide recommendations on dealing with them.

[1] https://www.joelonsoftware.com/2002/11/11/the-law-of-leaky-abstractions/

Comments

Comments are closed.

John Boctor at 11:56 on 16 May 2023

The talk had a lot of good “under the hood” information. It seemed to me though that the only place that abstractions leak is when you are trying to write database codes for many different types of databases and that didn’t seem too relevant.

Nick Marsceau at 11:57 on 16 May 2023

Good talk, and good tips on how to mitigate differences between database engines when supporting more than one.

Learned a few things like most char things being handled as streams.

Eli White at 12:21 on 16 May 2023

.

Dana Luther at 17:05 on 17 May 2023

There was a lot of great information in this talk, especially for anyone trying to build a product that they want to support multiple data backends for. I hadn’t realized there were such “gotcha” moments that need to be covered in case of those non-MySQL backends (shows how focused my db exposure has been!) It was a little hard to follow at the outset, but once I caught better on to what was being explained, it was great. People who are more focused on DBAL in everyday life probably wouldn’t have that same stumble.

Matt Libera at 09:14 on 18 May 2023

Quite interesting, especially for folks who aren't huge database buffs. It really sheds some light on the challenge of not only database abstractions, but wide-reaching abstractions in general.

Brandon Worby at 15:30 on 18 May 2023

enjoyed the talk.

Sergei Morozov (Speaker) at 19:53 on 19 May 2023

John Boctor, thank you for the feedback. Could you elaborate a bit more?

In all the cases I showed, the API consumer needs to be aware of the underlying database platform or the driver (i.e. the implementation details) to make their code work in a portable way. Is it what makes it leaky?