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

Skip to content

[Form] Deprecate the "choices_as_values" option of ChoiceType #16994

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
Dec 18, 2015

Conversation

nicolas-grekas
Copy link
Member

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

@xabbuh
Copy link
Member

xabbuh commented Dec 14, 2015

👍

@craue
Copy link
Contributor

craue commented Dec 14, 2015

Is there any way to "feature detect" whether or not this option needs to be set (to true)?

@stof
Copy link
Member

stof commented Dec 14, 2015

@craue method_exists(AbstractType::class, 'getName'), as this method has been removed in Symfony 3, and setting it is neccessary only in ~2.7 to get this behavior.

@craue
Copy link
Contributor

craue commented Dec 14, 2015

@stof, thanks. I wonder why AbstractType::getName isn't mentioned in the 3.0.0 changelog. But that's out of scope of this PR.

@stof
Copy link
Member

stof commented Dec 14, 2015

@craue because the changelog files are incomplete, as reported already. Latest removals have been forgotten

@nicolas-grekas nicolas-grekas merged commit 9aa5507 into symfony:master Dec 18, 2015
nicolas-grekas added a commit that referenced this pull request Dec 18, 2015
…iceType (nicolas-grekas)

This PR was merged into the 3.1-dev branch.

Discussion
----------

[Form] Deprecate the "choices_as_values" option of ChoiceType

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

Commits
-------

9aa5507 [Form] Deprecate the "choices_as_values" option of ChoiceType
@nicolas-grekas nicolas-grekas deleted the deprec-as-values branch December 18, 2015 08:57
@fabpot fabpot mentioned this pull request May 13, 2016
@LaurentMarquet
Copy link

LaurentMarquet commented Jul 1, 2016

I am using Symfony 3.1.2 and I receive the message: The "choices_as_values" option is deprecated since version 3.1 and will be removed in 4.0. You should not use it anymore. but I DON'T use "choices_as_values". I just use "choices" as shown below. Do I miss something ?

    ->add('advertiser', ChoiceType::class, array(
        'label' => 'label.advertiser',
        'disabled' => $disabled,
        'required' => true,
        'expanded' => true,
        'multiple' => false,
        'choices'  => array(
            'label.individual' => 'individual',
            'label.association' => 'association',
            ),
        'label_attr' => array(
            'class' => 'radio-inline'
        )))

Stack trace in case it helps

ChoiceType::Symfony\Component\Form\Extension\Core\Type\{closure}() (called from OptionsResolver.php at line 885)
    OptionsResolver::offsetGet() (called from OptionsResolver.php at line 716)
    OptionsResolver::resolve() (called from ResolvedFormType.php at line 95)
    ResolvedFormType::createBuilder() (called from ResolvedTypeDataCollectorProxy.php at line 83)
    ResolvedTypeDataCollectorProxy::createBuilder() (called from FormFactory.php at line 85)
    FormFactory::createNamedBuilder() (called from FormBuilder.php at line 106)
    FormBuilder::create() (called from FormBuilder.php at line 269)
    FormBuilder::resolveChildren() (called from FormBuilder.php at line 215)
    FormBuilder::getForm() (called from FormBuilder.php at line 221)
    FormBuilder::getForm() (called from FormFactory.php at line 39)
    FormFactory::create() (called from Controller.php at line 309)
    Controller::createForm() (called from AdController.php at line 144)
    AdController::displayLocaleCreateAdAction()
    call_user_func_array() (called from HttpKernel.php at line 153)
    HttpKernel::handleRaw() (called from HttpKernel.php at line 68)
    HttpKernel::handle() (called from Kernel.php at line 177)
    Kernel::handle() (called from app_dev.php at line 30)

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

Successfully merging this pull request may close these issues.

6 participants