Adapt code for Doctrine 2.4