clouway / twig-persist

twig-persist
0 stars 3 forks source link

map multiple entities to the same entity kind #19

Open mgenov opened 7 years ago

mgenov commented 7 years ago

It would be good if twig-persist allows single entity kind to be bound to separate entities as it is required for gradual code repair. (Moving from X to XEntity)

For example the current definition throws Exception:

AnnotationConfiguration.registerTypeName(Team.class, "Team");
AnnotationConfiguration.registerTypeName(TeamEntity.class, "Team");

as twig verifies that an existing entity is already bound to that kind.

This doesn't allow gradual code repair to be performed as kinds becomes different.

A custom function could be added about this cases as it will preserve the original behaveour and will add a new one:

AnnotationConfiguration.registerTypeNameUnsafe(Team.class, "Team");
AnnotationConfiguration.registerTypeNameUnsafe(TeamEntity.class, "Team");