if this is all that is specific to the doctrine variant, we might simply do a class_exists + instanceof check here, wdyt?