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

Skip to content

[Form] Fix a BC break in the entity #15277

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
Jul 15, 2015

Conversation

jakzal
Copy link
Contributor

@jakzal jakzal commented Jul 14, 2015

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

@webmozart this brings back the old behaviour. Attached test case passes on 2.3 with no code modifications.

Code here promises any integer number can be handled with createChoiceName():

            // If the object has a single-column, numeric ID, use that ID as
            // field name. We can only use numeric IDs as names, as we cannot
            // guarantee that a non-numeric ID contains a valid form name
            if ($idReader->isIntId()) {
                return array(__CLASS__, 'createChoiceName');
            }
            // Otherwise, an incrementing integer is used as name automatically

While createChoiceName() can only handle natural numbers.

@jakzal jakzal added the Form label Jul 14, 2015
@weaverryan
Copy link
Member

👍

1 similar comment
@xabbuh
Copy link
Member

xabbuh commented Jul 15, 2015

👍

@fabpot
Copy link
Member

fabpot commented Jul 15, 2015

Thank you @jakzal.

@fabpot fabpot merged commit 03642b8 into symfony:2.7 Jul 15, 2015
fabpot added a commit that referenced this pull request Jul 15, 2015
This PR was merged into the 2.7 branch.

Discussion
----------

[Form] Fix a BC break in the entity

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

@webmozart this brings back the old behaviour. Attached test case passes on 2.3 with no code modifications.

Code [here](https://github.com/symfony/symfony/blob/73bbaa6cc7d706b0e945107657fbd240efec0c97/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php#L199-L206) promises any integer number can be handled with `createChoiceName()`:

```php
            // If the object has a single-column, numeric ID, use that ID as
            // field name. We can only use numeric IDs as names, as we cannot
            // guarantee that a non-numeric ID contains a valid form name
            if ($idReader->isIntId()) {
                return array(__CLASS__, 'createChoiceName');
            }
            // Otherwise, an incrementing integer is used as name automatically
```

While `createChoiceName()` can only handle natural numbers.

Commits
-------

03642b8 [Form] Fix a BC break in the entity
@jakzal jakzal deleted the bugfix/form-negative-entity-id branch September 26, 2017 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants