8000 [FrameworkBundle][Validator] Fix apc cache service & config by ogizanagi · Pull Request #16794 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle][Validator] Fix apc cache service & config #16794

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions UPGRADE-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,25 @@ UPGRADE FROM 2.x to 3.0
`Symfony\Component\Form\Extension\Csrf\CsrfProvider 8000 \CsrfProviderInterface`
interface.
The `security.csrf.token_manager` should be used instead.

* The ability to pass `apc` as the `framework.validation.cache` config option value has been removed. Use `validator.mapping.cache.apc` instead:

Before:

```yaml
framework:
validation:
cache: apc
```

After:

```yaml
framework:
validation:
cache: validator.mapping.cache.apc
```


### HttpKernel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode)
->info('validation configuration')
->canBeEnabled()
->children()
->scalarNode('cache')
->beforeNormalization()
// Can be removed in 3.0, once ApcCache support is dropped
->ifString()->then(function ($v) { return 'apc' === $v ? 'validator.mapping.cache.apc' : $v; })
->end()
->end()
->scalarNode('cache')->end()
->booleanNode('enable_annotations')->defaultFalse()->end()
->arrayNode('static_method')
->defaultValue(array('loadValidatorMetadata'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This BC break should trigger a deprecation in previous versions right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deprecation seems to have been triggered through the new validator.mapping.cache.doctrine.apc service in previous versions...
And this service has been removed in 3.0.

I'm getting lost in the operation.
I think something went wrong during a merge or this wasn't expected to be as it is right now:
validator.mapping.cache.doctrine.apc wasn't supposed to be marked as deprecated nor removed IMO.
validator.mapping.cache.apc was.

I'm going to make validator.mapping.cache.apc an alias of the new validator.mapping.cache.doctrine.apc service, but it should probably have been removed instead.

Expand Down
12 changes: 10 additions & 2 deletions src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,16 @@

<service id="validator.mapping.class_metadata_factory" alias="validator" public="false" />

<service id="validator.mapping.cache.apc" class="Symfony\Component\Validator\Mapping\Cache\ApcCache" public="false">
<argument>%validator.mapping.cache.prefix%</argument>
<service id="validator.mapping.cache.apc" alias="validator.mapping.cache.doctrine.apc" />

<service id="validator.mapping.cache.doctrine.apc" class="Symfony\Component\Validator\Mapping\Cache\DoctrineCache" public="false">
<argument type="service">
<service class="Doctrine\Common\Cache\ApcCache">
<call method="setNamespace">
<argument>%validator.mapping.cache.prefix%</argument>
</call>
</service>
</argument>
</service>

<service id="validator.validator_factory" class="Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory" public="false">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
),
'validation' => array(
'enabled' => true,
'cache' => 'apc',
'cache' => 'validator.mapping.cache.apc',
),
'annotations' => array(
'cache' => 'file',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<framework:translator enabled="true" fallback="fr" logging="true">
<framework:path>%kernel.root_dir%/Fixtures/translations</framework:path>
</framework:translator>
<framework:validation enabled="true" cache="apc" />
<framework:validation enabled="true" cache="validator.mapping.cache.apc" />
<framework:annotations cache="file" debug="true" file-cache-dir="%kernel.cache_dir%/annotations" />
<framework:serializer enabled="true" enable-annotations="true" cache="serializer.mapping.cache.apc" name-converter="serializer.name_converter.camel_case_to_snake_case" />
</framework:config>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ framework:
paths: ['%kernel.root_dir%/Fixtures/translations']
validation:
enabled: true
cache: apc
cache: validator.mapping.cache.apc
annotations:
cache: file
debug: true
Expand Down
0