Updated doctrine compat and reworked model