8000 feature #14429 [FrameworkBundle] Add a doctrine cache service definit… · symfony/symfony@dd7583d · GitHub
[go: up one dir, main page]

Skip to content

Commit dd7583d

Browse files
committed
feature #14429 [FrameworkBundle] Add a doctrine cache service definition 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
2 parents 9f86195 + 0642911 commit dd7583d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@
3939
<argument>%validator.mapping.cache.prefix%</argument>
4040
</service>
4141

42+
<service id="validator.mapping.cache.doctrine.apc" class="Symfony\Component\Validator\Mapping\Cache\DoctrineCache" public="false">
43+
<argument type="service">
44+
<service class="Doctrine\Common\Cache\ApcCache">
45+
<call method="setNamespace">
46+
<argument>%validator.mapping.cache.prefix%</argument>
47+
</call>
48+
</service>
49+
</argument>
50+
</service>
51+
4252
<service id="validator.validator_factory" class="%validator.validator_factory.class%" public="false">
4353
<argument type="service" id="service_container" />
4454
<argument type="collection" />

0 commit comments

Comments
 (0)
0