-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Add a doctrine cache service definition for validator mapping #14429
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
Conversation
is this lazyloaded? 👎 This imo should just be documented http://www.craftitonline.com/2015/04/telling-symfony-to-use-cached-validation-from-doctrine-cache-bundle-provider/ |
@cordoval documenting is not enough imho. We need to provide an upgrade path. |
👍 |
👍 We should just add this to the docs after merging. |
Can we have the doc PR before merging? |
yes, we can (see symfony/symfony-docs#5409) |
Any feedback on this one? |
👍 Does not hurt to have this extra service anyway. Having some other alternatives would be good as well but out of the scope of this PR. |
Ok then. Let's merge :) |
Thank you @jakzal. |
…ion for validator mapping (jakzal) This PR was merged into the 2.8 branch. Discussion ---------- [FrameworkBundle] Add a doctrine cache service definition for validator mapping | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | symfony/symfony-docs#5409 Following #12975, this PR only registers a new service so it's possible to use the new doctrine based cache implementation instead of the deprecated one. To use it, the end user would need to configure it in his `config.yml`: ```yaml framework: validation: cache: validator.mapping.cache.doctrine.apc ``` In 3.0 we'll be able to replace the deprecated definition by aliasing `validator.mapping.cache.apc` to `validator.mapping.cache.doctrine.apc`. I thought of automatic wrapping of services which implement doctrine interface, but decided it would be too magic. I'm not convinced if APC is a good default anymore and hope for some discussion. I've used it as it's also used in serializer, and probably translation (see #13986). Since there's a built in opcache in more recent PHP versions, and apcu doesn't seem to be stable, there are better choices. Perhaps a better default would be a filesystem cache (not better performing, but it works anywhere). Commits ------- 0642911 [FrameworkBundle] Add a doctrine cache service definition for validator mapping
@jakzal I think we should also provide an easy way to configure a DoctrineCache wrapping an existing service. This would allow people to configure their cache service thanks to DoctrineCacheBundle (included by default in the SE as it is a dependency of DoctrineBundle), giving them support for any cache backend supported in Doctrine, and then having Frameworkbundle only dealing with configuring the Symfony adapter wrapping it (we could also do this in other places allowing to use doctrine-based cache adapter btw). |
@stof the only reason why I haven't done this yet is I couldn't decide how to configure it. Would this be acceptable? framework:
validation:
cache:
doctrine: some.doctrine_cache.service So |
…bbuh) This PR was merged into the 2.8 branch. Discussion ---------- [Reference] document new Doctrine APC cache service | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes (symfony/symfony#14429) | Applies to | 2.8+ | Fixed tickets | Commits ------- 485c8a0 document new Doctrine APC cache service
Following #12975, this PR only registers a new service so it's possible to use the new doctrine based cache implementation instead of the deprecated one. To use it, the end user would need to configure it in his
config.yml
:In 3.0 we'll be able to replace the deprecated definition by aliasing
validator.mapping.cache.apc
tovalidator.mapping.cache.doctrine.apc
.I thought of automatic wrapping of services which implement doctrine interface, but decided it would be too magic.
I'm not convinced if APC is a good default anymore and hope for some discussion. I've used it as it's also used in serializer, and probably translation (see #13986). Since there's a built in opcache in more recent PHP versions, and apcu doesn't seem to be stable, there are better choices. Perhaps a better default would be a filesystem cache (not better performing, but it works anywhere).