Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Form] Fixed regression: Empty values were not accepted anymore for collapsed, optional choice fields #14465

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

Merged
merged 1 commit into from
May 5, 2015

Conversation

webmozart
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #14393
License MIT
Doc PR -

'multiple' => false,
'expanded' => false,
'choices' => array(
'EMPTY_CHOICE' => 'Empty',
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't this have to use choices_as_values: true to not use the deprecated functionality? I guess the trigger_error is missing for the old choices structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. I'll add the trigger_error statement in a separate PR.

@webmozart webmozart merged commit 7997f24 into symfony:2.7 May 5, 2015
webmozart added a commit that referenced this pull request May 5, 2015
…ymore for collapsed, optional choice fields (webmozart)

This PR was merged into the 2.7 branch.

Discussion
----------

[Form] Fixed regression: Empty values were not accepted anymore for collapsed, optional choice fields

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #14393
| License       | MIT
| Doc PR        | -

Commits
-------

7997f24 [Form] Fixed regression: Empty values were not accepted anymore for collapsed, optional choice fields
@mbartok
Copy link

mbartok commented May 10, 2015

I still cannot submit optional entity filed (extended choice field) using empty_value with doctrine on Symfony 2.7 (e60f715).

Field definition:

$builder->add('dealer', 'entity', array(
    'label' => 'useraccount.label.dealer',
    'class' => 'MyAppBundle:Subject',
    'choice_label' => 'label',
    'empty_value' => '',
    'multiple' => false,
    'required' => false
));

After submitting empty value i get this error:

SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: ""

It seems like Symfony is trying to find Subject entity using empty string as id for dealer field:

DBALException: An exception occurred while executing 'SELECT ... FROM subject s0_ WHERE s0_.id IN (?)' with params [""]:

@xabbuh
Copy link
Member

xabbuh commented May 10, 2015

see #14583

@xabbuh xabbuh mentioned this pull request May 12, 2015
1 task
sasedev added a commit to sasedev/doctrine-bridge that referenced this pull request Dec 25, 2015
Type::GUID can be used as entity ID and is Connection::PARAM_STR_ARRAY

when submitting form with required set to FALSE and empty entity with Type::GUID as entity ID,
we still receive an SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for uuid: ""
in the PostgreSQL Platform for example.

symfony/symfony#14465 ???
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants