sonata-project / SonataCoreBundle

[deprecated] SonataCoreBundle
MIT License
318 stars 138 forks source link

TransformationFailedException: "Submitted data was expected to be text or number, array given." #696

Closed Pasuvan closed 3 years ago

Pasuvan commented 5 years ago

Environment

Local

Sonata packages

$ composer show --latest 'sonata-project/*'
sonata-project/admin-bundle              3.13.0 The missing Symfony Admin G...
sonata-project/block-bundle              3.13.0 Symfony SonataBlockBundle
sonata-project/cache                     2.0.1  Cache library
sonata-project/classification-bundle     3.6.1  Symfony SonataClassificatio...
sonata-project/core-bundle               3.13.4 Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.5.0  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.3.0  Doctrine2 behavioral extens...
sonata-project/doctrine-orm-admin-bundle 3.1.7  Symfony Sonata / Integrate ...
sonata-project/easy-extends-bundle       2.5.0  Symfony SonataEasyExtendsBu...
sonata-project/exporter                  1.11.1 Lightweight Exporter library
sonata-project/intl-bundle               2.5.0  Symfony SonataIntlBundle
sonata-project/media-bundle              3.5.0  Symfony SonataMediaBundle
sonata-project/notification-bundle       3.6.1  Symfony SonataNotificationB...

Symfony packages

$ composer show --latest 'symfony/*'
sonata-project/admin-bundle              3.24.0 3.48.1 The missing Symfony Admin Generator
sonata-project/block-bundle              3.15.0 3.15.0 Symfony SonataBlockBundle
sonata-project/cache                     2.0.1  2.0.1  Cache library
sonata-project/classification-bundle     3.6.1  3.8.0  Symfony SonataClassificationBundle
sonata-project/core-bundle               3.17.0 3.17.0 Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.5.0  3.0.0  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.3.0  1.3.0  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.1.7  3.9.0  Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.5.0  2.5.0  Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.11.1 2.0.1  Lightweight Exporter library
sonata-project/intl-bundle               2.5.0  2.5.0  Symfony SonataIntlBundle
sonata-project/media-bundle              3.5.0  3.19.1 Symfony SonataMediaBundle
sonata-project/notification-bundle       3.6.1  3.6.1  Symfony SonataNotificationBundle

PHP version

$ php -v
PHP 7.3.4-1+ubuntu14.04

Subject

I upgrade symfony 3.2 to 3.4, So i have upgrade symfony and sonata bundles. Here using custom form Transformer collectionType(Array collection). Before using symfony 3.2 it was working but once upgrade showing an error.

Steps to reproduce

Expected results

Actual results

core23 commented 5 years ago

Please fill out the whole issue template and use a better issue title. This will helper others with the same problem

Pasuvan commented 5 years ago

I have some clue for symfony form anyone know that reason please share me faster https://github.com/symfony/symfony/blob/3.2/src/Symfony/Component/Form/Form.php Line ni 537 https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/Form/Form.php Line no 534 I check that different for the above two files only one changes in 3.4 .It is added below anyone know that reason please share me faster

if (\is_array($submittedData) && !$this->config->getCompound() && !$this->config->hasOption('multiple')) {
            $submittedData = null;
            $this->transformationFailure = new TransformationFailedException('Submitted data was expected to be text or number, array given.');
        }
Pasuvan commented 5 years ago

I have some clue for symfony form anyone know that reason please share me faster https://github.com/symfony/symfony/blob/3.2/src/Symfony/Component/Form/Form.php Line ni 537 https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/Form/Form.php Line no 534 I check that different for the above two files only one changes in 3.4 .It is added below anyone know that reason please share me faster

if (\is_array($submittedData) && !$this->config->getCompound() && !$this->config->hasOption('multiple')) {
            $submittedData = null;
            $this->transformationFailure = new TransformationFailedException('Submitted data was expected to be text or number, array given.');
        }

When I updated Custom 'Collection type with transform form' I got an error in "Submitted data was expected to be text or number, array given" please give a solution

core23 commented 5 years ago

Please fill out the whole issue template and use a better issue title. This will helper others with the same problem

:top:

We can't help without any useful information. This issue is to unspecific.

muthupandifsp commented 5 years ago

I faced same issue. Also Please explain the usage of checking the following condition $this->config->getCompound() $this->config->hasOption('multiple')

The above issue is occured when I use custom collection type field.

Pasuvan commented 5 years ago

Please fill out the whole issue template and use a better issue title. This will helper others with the same problem

We can't help without any useful information. This issue is to unspecific. I give the all details, What details you want?

Pasuvan commented 5 years ago

Hi @all, Please, anyone, give the details, why this condition is used thats details enough for me. if (\is_array($submittedData) && !$this->config->getCompound() && !$this->config->hasOption('multiple')) { $submittedData = null; $this->transformationFailure = new TransformationFailedException('Submitted data was expected to be text or number, array given.'); }

Younly commented 4 years ago

is there a solution

jordisala1991 commented 3 years ago

This bundle is deprecated.