How to configure Doctrine using yaml

I rewrote the solution proposed by mahok in http://stackoverflow.com/a/14988359/842697