Doctrine 2 support, closes #1232