JMSTranslationBundle icon indicating copy to clipboard operation
JMSTranslationBundle copied to clipboard

FormType : @Ignore with choices

Open AntoineLemaire opened this issue 10 years ago • 8 comments

The @Ignore annotation does not work with choices

$form->add('status','choice', [
    'choices'   => [
        1 => /** @Ignore */'Yes', 
        0 => /** @Ignore */'No'
    ],
    'required' => false,
])

or

$form->add('status','choice', [
    /** @Ignore */
    'choices'   => [
        1 => 'Yes', 
        0 => 'No'
    ],
    'required' => false,
])

or even

/** @Ignore */
$form->add('status','choice', [
    'choices'   => [
        1 => 'Yes', 
        0 => 'No'
    ],
    'required' => false,
])

AntoineLemaire avatar Feb 25 '15 10:02 AntoineLemaire

i have the same issue

christoferw avatar May 12 '15 08:05 christoferw

same issue

unmecduweb avatar Jul 10 '15 08:07 unmecduweb

same for me

filipegarcia avatar Jul 10 '15 08:07 filipegarcia

this worked for me:

$choices = array('choice 1', 'choice 2');
$builder->add('_choice', 'choice', array(
    /** @Ignore */'choices' => $choices
));

dswbx avatar Oct 29 '15 09:10 dswbx

I know it was a long time ago you posted this issue. Do you still experiencing this? Or is it fixed in the latest version of the bundle?

Nyholm avatar Aug 04 '16 16:08 Nyholm

Unfortunately I can't answer you. I don't use JMSTranslationBundle anymore :disappointed:

But it could be easy to test. Just need to extract translations with the three cases above.

AntoineLemaire avatar Aug 04 '16 16:08 AntoineLemaire

I've testet it now and the issue does still exist. This is only when I use the formBuilder in the controller.

Nyholm avatar Aug 04 '16 16:08 Nyholm

I can confirm the same

yellow1912 avatar Oct 14 '16 03:10 yellow1912