ModelManager icon indicating copy to clipboard operation
ModelManager copied to clipboard

Can not extends model

Open webaaz opened this issue 10 years ago • 1 comments

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

webaaz avatar Oct 07 '15 15:10 webaaz

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?

chanmix51 avatar Sep 13 '18 14:09 chanmix51