-
-
Notifications
You must be signed in to change notification settings - Fork 344
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
Does not mark ModelManager as final anymore #1144
Conversation
It's not possible to use service decoration here? |
Not sure to understand what you mean here. I inject my own ModelManager instead of the doctrineORMModelManager everywhere I need it. But I need to extends the doctrineORMModelManager to avoid copy-pasting all the other methods I don't need to override. This is the implementation of
I can't use another SourceIterator without overriding this method. Maybe changing the
could help. And then, people can override But still, there are method like
which are some methods that developper will often wants to override. |
IMHO those methods shouldn't belong to |
This is the implementation on master:
We could deprecate these methods. And implement this directly in SonataAdmin WDYT ? |
I made sonata-project/SonataAdminBundle#6458 as an example of the possible changes. |
I was talking about this: https://symfony.com/doc/current/service_container/service_decoration.html You create a proxy class that will delegate all calls to the original one and just reimplement the one you need. |
I never used service decoration. Does it work this way ?
I hope it's not the right way. So, if not, can you give a real example ? |
That's how you should do it. I know there is some copy & paste stuff, but that's an other problem (god object). A few months / years ago we decided to advice service decoration so we can close our api. The ideas was based on this. This will allow us to do some changes that would otherwise result in a BC break. |
IMHO, we should fix the god object problem BEFORE changing the class for final. That's why I proposed:
And that allow to decorate the sourceIteratorFactoryInterface instead of the whole ModelManager. |
In fact, looks like it should belong somewhere else, apparently there are no references to the class itself (I haven't thought where though). |
I'll be happy to move this somewhere else if you have a good idea. The part
is persistenceBundle-specific. I think that currently most of the persistenceBundle-specific code is injected with the ModelManager (especially when it's about query), that's why it's here. |
I'd create something under |
I made a PR to discuss about this sonata-project/SonataAdminBundle#6463 |
Could you please rebase your PR and fix merge conflicts? |
Related to sonata-project/SonataDoctrineMongoDBAdminBundle#437 (review)