Quantcast
Channel: Database – Entropy Wins
Viewing all articles
Browse latest Browse all 4

Doctrine QueryBuilder table alias

$
0
0

The Doctrine project, best known for its Object Relational Mapper, also includes a database abstraction layer, used by the ORM. This abstraction layer is called DBAL, for DataBase Abstraction Layer.

Quickly after I started using DBAL in some Wikibase components, I got annoyed at how single table single table selects needed to be created. The QueryBuilder has a “from” method, in which one needs to specify the table name. The annoying bit is that you also had to specify a table alias, and then use this alias in the select and where calls as well.

dbal-old

In an hour of free time and several commits I made the parameter optional, enabling one to do the same without having to specify the alias:

dbal-new

This change will be part of the upcoming Doctrine DBAL 2.5.


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles



Latest Images