Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not extends model #53

Open
webaaz opened this issue Oct 7, 2015 · 1 comment
Open

Can not extends model #53

webaaz opened this issue Oct 7, 2015 · 1 comment

Comments

@webaaz
Copy link
Contributor

webaaz commented Oct 7, 2015

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 chanmix51 added the bug label Oct 7, 2015
@chanmix51 chanmix51 added this to the 2.1 milestone Feb 5, 2017
@chanmix51
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants