Only try to clear Doctrine if it's available