Doctrine optimization