Now using Doctrine ORM

A bunch of tweaks and enhancements that allow for the use of Doctrine ORM