Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[FrameworkBundle] Fix deprecation layer for "enable_annotations" in validation and serializer configuration#52287

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:6.4fromlyrixx:enable_annotations
Oct 31, 2023
Merged
Changes fromall 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
[FrameworkBundle] Fix BC break about enable_annotations in validation…
… and serializer configuration
  • Loading branch information
@lyrixx
lyrixx committedOct 30, 2023
commitbd0538d3049bafec97f5ec7a9fb2075d38fa753c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1026,27 +1026,30 @@ private function addValidationSection(ArrayNodeDefinition $rootNode, callable $e
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.validation.email_validation_mode" config option is deprecated. It will default to "html5" in 7.0.');
}

if (isset($v['enable_annotations'])) {
trigger_deprecation('symfony/framework-bundle', '6.4', 'Option "enable_annotations" at "framework.validation" is deprecated. Use the "enable_attributes" option instead.');

if (!isset($v['enable_attributes'])) {
$v['enable_attributes'] = $v['enable_annotations'];
} else {
throw new LogicException('The "enable_annotations" and "enable_attributes" options at path "framework.validation" must not be both set. Only the "enable_attributes" option must be used.');
}
}

return $v;
})
->end()
->children()
->arrayNode('validation')
->beforeNormalization()
->ifTrue(fn ($v) => isset($v['enable_annotations']))
->then(function ($v) {
trigger_deprecation('symfony/framework-bundle', '6.4', 'Option "enable_annotations" at "framework.validation" is deprecated. Use the "enable_attributes" option instead.');

if (isset($v['enable_attributes'])) {
throw new LogicException('The "enable_annotations" and "enable_attributes" options at path "framework.validation" must not be both set. Only the "enable_attributes" option must be used.');
}
$v['enable_attributes'] = $v['enable_annotations'];

return $v;
})
->end()
->info('validation configuration')
->{$enableIfStandalone('symfony/validator', Validation::class)}()
->children()
->scalarNode('cache')->end()
->booleanNode('enable_annotations')->end()
->booleanNode('enable_attributes')->{!class_exists(FullStack::class) ? 'defaultTrue' : 'defaultFalse'}()->end()
->booleanNode('enable_attributes')->{class_exists(FullStack::class) ? 'defaultFalse' : 'defaultTrue'}()->end()
->arrayNode('static_method')
->defaultValue(['loadValidatorMetadata'])
->prototype('scalar')->end()
Expand DownExpand Up@@ -1152,25 +1155,24 @@ private function addSerializerSection(ArrayNodeDefinition $rootNode, callable $e
$rootNode
->children()
->arrayNode('serializer')
->validate()
->always(function ($v){
if (isset($v['enable_annotations'])) {
->beforeNormalization()
->ifTrue(fn ($v)=> isset($v['enable_annotations']))
->then(function ($v) {
trigger_deprecation('symfony/framework-bundle', '6.4', 'Option "enable_annotations" at "framework.serializer" is deprecated. Use the "enable_attributes" option instead.');

if (!isset($v['enable_attributes'])) {
$v['enable_attributes'] = $v['enable_annotations'];
} else {
if (isset($v['enable_attributes'])) {
throw new LogicException('The "enable_annotations" and "enable_attributes" options at path "framework.serializer" must not be both set. Only the "enable_attributes" option must be used.');
}
}
$v['enable_attributes'] = $v['enable_annotations'];

return $v;
})->end()
return $v;
})
->end()
->info('serializer configuration')
->{$enableIfStandalone('symfony/serializer', Serializer::class)}()
->children()
->booleanNode('enable_annotations')->end()
->booleanNode('enable_attributes')->{!class_exists(FullStack::class) ? 'defaultTrue' : 'defaultFalse'}()->end()
->booleanNode('enable_attributes')->{class_exists(FullStack::class) ? 'defaultFalse' : 'defaultTrue'}()->end()
->scalarNode('name_converter')->end()
->scalarNode('circular_reference_handler')->end()
->scalarNode('max_depth_handler')->end()
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp