-
Notifications
You must be signed in to change notification settings - Fork 231
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
Migrate config to PHP #810
Conversation
49fd8d4
to
0bf8da2
Compare
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.
Splitting the file is a very good idea.
We should get rid of all the .class
parameters (see symfony/symfony#11881)
Resources/config/mongodb.php
Outdated
->set('doctrine_mongodb.odm.cache.xcache.class', 'Doctrine\Common\Cache\XcacheCache') | ||
->set('doctrine_mongodb.odm.connection.class', Client::class) | ||
->set('doctrine_mongodb.odm.configuration.class', Configuration::class) | ||
->set('doctrine_mongodb.odm.document_manager.class', DocumentManager::class) |
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.
This parameter should be deprecated. If someone really wants to change the class for this service, they should update its definition in a compiler pass.
I propose to deprecate updating this parameters in 4.7
b94fcbb
to
187fc88
Compare
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.
SGTM
@@ -17,8 +17,10 @@ | |||
use Doctrine\Common\Cache\RedisCache; | |||
use Doctrine\Common\DataFixtures\Loader as DataFixturesLoader; | |||
use Doctrine\Common\EventSubscriber; | |||
use Doctrine\ODM\MongoDB\Configuration as MongoDBConfiguration; |
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.
I'm nitpicking, but it's all mongodb here. We can specify ODM.
use Doctrine\ODM\MongoDB\Configuration as MongoDBConfiguration; | |
use Doctrine\ODM\MongoDB\Configuration as ODMConfiguration; |
->set('doctrine_mongodb.odm.cache.array.class', 'Doctrine\Common\Cache\ArrayCache') | ||
->set('doctrine_mongodb.odm.cache.apc.class', 'Doctrine\Common\Cache\ApcCache') | ||
->set('doctrine_mongodb.odm.cache.apcu.class', 'Doctrine\Common\Cache\ApcuCache') | ||
->set('doctrine_mongodb.odm.cache.memcache.class', 'Doctrine\Common\Cache\MemcacheCache') | ||
->set('doctrine_mongodb.odm.cache.memcache_host', 'localhost') | ||
->set('doctrine_mongodb.odm.cache.memcache_port', 11211) | ||
->set('doctrine_mongodb.odm.cache.memcache_instance.class', 'Memcache') | ||
->set('doctrine_mongodb.odm.cache.xcache.class', 'Doctrine\Common\Cache\XcacheCache') | ||
->set('doctrine_mongodb.odm.metadata.driver_chain.class', MappingDriverChain::class) | ||
->set('doctrine_mongodb.odm.metadata.attribute.class', AttributeDriver::class) | ||
->set('doctrine_mongodb.odm.metadata.xml.class', XmlDriver::class); |
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.
Related to #811, the parameters should be deprecated here.
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.
This is partially related to #804, these parameters are apparently used in the AbstractDoctrineExtension, this is the code related about cache:
And the related to the metadata:
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.
Even if we stop using them, we have to keep and deprecate them in 2.x, as they could be used in applications.
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.
I was thinking that since these parameters seem to be used for internal configuration, maybe Symfony can try to fetch them first as build parameters (prefixing the parameter with a ".") and fallback to "normal", I'll see if I have time tomorrow to open a PR there for that.
Update: Symfony always calls an abstract method that is implemented in our side to get the parameter name, so the build parameters can be implemented in our side I think.
Update2: We can do it for metadata parameters, but for cache parameters I think need to be done in the AbstractDoctrineExtension
, I'll take a look tomorrow if I find some time.
Thank you @franmomu |
Closes #807
I've made some changes that we need to see if they are fine.
doctrine_mongodb.odm.cache
as alias ofdoctrine_mongodb.odm.cache.array
doctrine_mongodb.odm.cache.array
.class
and use the class directly in the service as second argument.I'm not sure if that can be done in PHP and I've changed them to (I guess we can change them in the extension resolving the parameter, but not sure if that's necessary):