-
-
Notifications
You must be signed in to change notification settings - Fork 494
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
Make sonata.media.admin.media.manager
an alias of sonata.admin.manager.orm
/ sonata.admin.manager.doctrine_mongodb
#1821
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a fine solution 👍
I think this is a good proposal, I'd just like to have a clear idea about how both services are currently registered, in order to avoid any potential edge case where the aliased service could not be found. |
The service |
9483e27
to
f18c04b
Compare
sonata.media.admin.media.manager
an alias of `sonata.admin.man…sonata.media.admin.media.manager
an alias of sonata.admin.manager.orm
This service was unconditionally available before this change. Now, it aliases a service which might not exist if |
The class these two services are currently referring to is Furthermore, sonata_orm_admin.xml will only be loaded when the I would prefer to remove the sonata.media.admin.media.manager service altogether and change the |
I'm referring to these sibling services: The
But not
|
…undle model manager service Instead of duplicating the existing `sonata.admin.manager.orm` or `sonata.admin.manager.doctrine_mongodb` services. This prevents a deprecation notice for sonata-project/doctrine-orm-admin-bundle since 3.22 and sonata-project/doctrine-mongodb-admin-bundle for the first release after 3.3.0.
f18c04b
to
5ab890b
Compare
I hadn't looked at the other persistence bundles. It's interesting that PHPCR already uses an alias. This confirms that it works. I changed mongodb too, which seems to have the same deprecation situation (see sonata-project/SonataDoctrineMongoDBAdminBundle@b382c81) |
sonata.media.admin.media.manager
an alias of sonata.admin.manager.orm
sonata.media.admin.media.manager
an alias of sonata.admin.manager.orm
/ sonata.admin.manager.doctrine_mongodb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent!
I think we could remove the "sonata.media.admin.media.manager" definition if its aliased service doesn't exist (which is the case for custom managers).
@phansys What situation would that be? Wouldn't |
We are currently supporting 3 built-in managers: SonataMediaBundle/src/DependencyInjection/Configuration.php Lines 45 to 52 in f18c04b
So, forget about my last comment. |
Thank you @jorrit! |
Subject
Since sonata-project/doctrine-orm-admin-bundle 3.22 the constructor of
Sonata\DoctrineORMAdminBundle\Model\ModelManager
throws a deprecation warning when the second argument is not provided. The filedoctrine_orm_admin.xml
of the media bundle registers this class as the servicesonata.media.admin.media.manager
without this argument. I think this service can be made an alias ofsonata.admin.manager.orm
. This makes sure the parameters are correct regardless of the orm bundle version.Maybe I've overlooked something that would make this solution invalid, but it seems this solution also makes sure there is just one instance of the
ModelManager
, which seems a plus.I am targeting this branch, because it is a backwards compatible change.
Changelog