Doctrine 2 support, closes #1329