Common code for Zend Framework 2 projects based on Doctrine 2 logic