bug #38153 Move form error normalizer to the Serializer component (fabpot)
This PR was merged into the 5.2-dev branch.
Discussion
----------
Move form error normalizer to the Serializer component
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | n/a<!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | n/a
Commits
-------
c053db5553
Move form error normalizer to the Serializer component
This commit is contained in:
commit
dafcc58e6b
@ -34,7 +34,6 @@ use Symfony\Component\Form\FormRegistry;
|
|||||||
use Symfony\Component\Form\FormRegistryInterface;
|
use Symfony\Component\Form\FormRegistryInterface;
|
||||||
use Symfony\Component\Form\ResolvedFormTypeFactory;
|
use Symfony\Component\Form\ResolvedFormTypeFactory;
|
||||||
use Symfony\Component\Form\ResolvedFormTypeFactoryInterface;
|
use Symfony\Component\Form\ResolvedFormTypeFactoryInterface;
|
||||||
use Symfony\Component\Form\Serializer\FormErrorNormalizer;
|
|
||||||
use Symfony\Component\Form\Util\ServerParams;
|
use Symfony\Component\Form\Util\ServerParams;
|
||||||
|
|
||||||
return static function (ContainerConfigurator $container) {
|
return static function (ContainerConfigurator $container) {
|
||||||
@ -146,8 +145,5 @@ return static function (ContainerConfigurator $container) {
|
|||||||
param('validator.translation_domain'),
|
param('validator.translation_domain'),
|
||||||
])
|
])
|
||||||
->tag('form.type_extension')
|
->tag('form.type_extension')
|
||||||
|
|
||||||
->set('form.serializer.normalizer.form_error', FormErrorNormalizer::class)
|
|
||||||
->tag('serializer.normalizer', ['priority' => -915])
|
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
@ -38,6 +38,7 @@ use Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer;
|
|||||||
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
|
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
|
||||||
use Symfony\Component\Serializer\Normalizer\DateTimeZoneNormalizer;
|
use Symfony\Component\Serializer\Normalizer\DateTimeZoneNormalizer;
|
||||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||||
|
use Symfony\Component\Serializer\Normalizer\FormErrorNormalizer;
|
||||||
use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer;
|
use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer;
|
||||||
use Symfony\Component\Serializer\Normalizer\MimeMessageNormalizer;
|
use Symfony\Component\Serializer\Normalizer\MimeMessageNormalizer;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||||
@ -110,6 +111,9 @@ return static function (ContainerConfigurator $container) {
|
|||||||
->set('serializer.normalizer.uid', UidNormalizer::class)
|
->set('serializer.normalizer.uid', UidNormalizer::class)
|
||||||
->tag('serializer.normalizer', ['priority' => -915])
|
->tag('serializer.normalizer', ['priority' => -915])
|
||||||
|
|
||||||
|
->set('serializer.normalizer.form_error', FormErrorNormalizer::class)
|
||||||
|
->tag('serializer.normalizer', ['priority' => -915])
|
||||||
|
|
||||||
->set('serializer.normalizer.object', ObjectNormalizer::class)
|
->set('serializer.normalizer.object', ObjectNormalizer::class)
|
||||||
->args([
|
->args([
|
||||||
service('serializer.mapping.class_metadata_factory'),
|
service('serializer.mapping.class_metadata_factory'),
|
||||||
|
@ -40,7 +40,6 @@ use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
|
|||||||
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
|
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\Form\Serializer\FormErrorNormalizer;
|
|
||||||
use Symfony\Component\HttpClient\MockHttpClient;
|
use Symfony\Component\HttpClient\MockHttpClient;
|
||||||
use Symfony\Component\HttpClient\ScopingHttpClient;
|
use Symfony\Component\HttpClient\ScopingHttpClient;
|
||||||
use Symfony\Component\HttpKernel\DependencyInjection\LoggerPass;
|
use Symfony\Component\HttpKernel\DependencyInjection\LoggerPass;
|
||||||
@ -53,6 +52,7 @@ use Symfony\Component\Serializer\Normalizer\ConstraintViolationListNormalizer;
|
|||||||
use Symfony\Component\Serializer\Normalizer\DataUriNormalizer;
|
use Symfony\Component\Serializer\Normalizer\DataUriNormalizer;
|
||||||
use Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer;
|
use Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer;
|
||||||
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
|
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
|
||||||
|
use Symfony\Component\Serializer\Normalizer\FormErrorNormalizer;
|
||||||
use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer;
|
use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer;
|
||||||
use Symfony\Component\Serializer\Serializer;
|
use Symfony\Component\Serializer\Serializer;
|
||||||
use Symfony\Component\Translation\DependencyInjection\TranslatorPass;
|
use Symfony\Component\Translation\DependencyInjection\TranslatorPass;
|
||||||
@ -1159,7 +1159,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
{
|
{
|
||||||
$container = $this->createContainerFromFile('full');
|
$container = $this->createContainerFromFile('full');
|
||||||
|
|
||||||
$definition = $container->getDefinition('form.serializer.normalizer.form_error');
|
$definition = $container->getDefinition('serializer.normalizer.form_error');
|
||||||
$tag = $definition->getTag('serializer.normalizer');
|
$tag = $definition->getTag('serializer.normalizer');
|
||||||
|
|
||||||
$this->assertEquals(FormErrorNormalizer::class, $definition->getClass());
|
$this->assertEquals(FormErrorNormalizer::class, $definition->getClass());
|
||||||
|
@ -4,7 +4,6 @@ CHANGELOG
|
|||||||
5.2.0
|
5.2.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
* added `FormErrorNormalizer`
|
|
||||||
* Added support for using the `{{ label }}` placeholder in constraint messages, which is replaced in the `ViolationMapper` by the corresponding field form label.
|
* Added support for using the `{{ label }}` placeholder in constraint messages, which is replaced in the `ViolationMapper` by the corresponding field form label.
|
||||||
|
|
||||||
5.1.0
|
5.1.0
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
"symfony/http-foundation": "^4.4|^5.0",
|
"symfony/http-foundation": "^4.4|^5.0",
|
||||||
"symfony/http-kernel": "^4.4|^5.0",
|
"symfony/http-kernel": "^4.4|^5.0",
|
||||||
"symfony/security-csrf": "^4.4|^5.0",
|
"symfony/security-csrf": "^4.4|^5.0",
|
||||||
"symfony/serializer": "^4.4|^5.0",
|
|
||||||
"symfony/translation": "^4.4|^5.0",
|
"symfony/translation": "^4.4|^5.0",
|
||||||
"symfony/var-dumper": "^4.4|^5.0"
|
"symfony/var-dumper": "^4.4|^5.0"
|
||||||
},
|
},
|
||||||
|
@ -4,8 +4,10 @@ CHANGELOG
|
|||||||
5.2.0
|
5.2.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
* added `CompiledClassMetadataFactory` and `ClassMetadataFactoryCompiler` for faster metadata loading.
|
* added `CompiledClassMetadataFactory` and `ClassMetadataFactoryCompiler` for faster metadata loading.
|
||||||
* added `UidNormalizer`
|
* added `UidNormalizer`
|
||||||
|
* added `FormErrorNormalizer`
|
||||||
|
* added `MimeMessageNormalizer`
|
||||||
|
|
||||||
5.1.0
|
5.1.0
|
||||||
-----
|
-----
|
||||||
|
@ -9,11 +9,9 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Form\Serializer;
|
namespace Symfony\Component\Serializer\Normalizer;
|
||||||
|
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
|
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalizes invalid Form instances.
|
* Normalizes invalid Form instances.
|
@ -9,13 +9,13 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Form\Tests\Serializer;
|
namespace Symfony\Component\Serializer\Tests\Normalizer;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Form\FormError;
|
use Symfony\Component\Form\FormError;
|
||||||
use Symfony\Component\Form\FormErrorIterator;
|
use Symfony\Component\Form\FormErrorIterator;
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
use Symfony\Component\Form\Serializer\FormErrorNormalizer;
|
use Symfony\Component\Serializer\Normalizer\FormErrorNormalizer;
|
||||||
|
|
||||||
class FormErrorNormalizerTest extends TestCase
|
class FormErrorNormalizerTest extends TestCase
|
||||||
{
|
{
|
@ -29,6 +29,7 @@
|
|||||||
"symfony/dependency-injection": "^4.4|^5.0",
|
"symfony/dependency-injection": "^4.4|^5.0",
|
||||||
"symfony/error-handler": "^4.4|^5.0",
|
"symfony/error-handler": "^4.4|^5.0",
|
||||||
"symfony/filesystem": "^4.4|^5.0",
|
"symfony/filesystem": "^4.4|^5.0",
|
||||||
|
"symfony/form": "^4.4|^5.0",
|
||||||
"symfony/http-foundation": "^4.4|^5.0",
|
"symfony/http-foundation": "^4.4|^5.0",
|
||||||
"symfony/http-kernel": "^4.4|^5.0",
|
"symfony/http-kernel": "^4.4|^5.0",
|
||||||
"symfony/mime": "^4.4|^5.0",
|
"symfony/mime": "^4.4|^5.0",
|
||||||
|
Reference in New Issue
Block a user