pomm-project / ModelManager

Model Manager for the Pomm database framework.
MIT License
66 stars 27 forks source link

Can not extends model #53

Open webaaz opened 8 years ago

webaaz commented 8 years ago

I tried to extends a model, but can't done it without defining a new flexibleEntity. Without this new flexibleEntity, I got an error : A converter named \'\Database\OrganizationSchema\People\' already exists

chanmix51 commented 5 years ago

Fixing this issue is easy: it means the model classes can override an existing entity converter when they register to the session (which is prohibited by default by using a strict register method). I have spent a couple of hours thinking about the side effects of disabling the strct register method for model class.

In the case an inherited model class is using the same entity class as its parent with the same structure, it would just override the converter with the exactly same converter. But if, for some cases, the parent has a different structure with the same attached entity, this will override the parent entity converter leading to queries mysteriously failing from times to times. This would be a very nasty side effect very difficult to trace and sort out.

I finally ended up with the conclusion that inherited model class should also use an inherited entity class.

Thoughts?