ChoiceListInterface::getStructuredValues()

string[] getStructuredValues()

Returns the values in the structure originally passed to the list.

Contrary to {@link getValues()}, the result is indexed by the original keys of the choices. If the original array contained nested arrays, these nested arrays are represented here as well:

$form->add('field', 'choice', array(
    'choices' => array(
        'Decided' => array('Yes' => true, 'No' => false),
        'Undecided' => array('Maybe' => null),
    ),
));

In this example, the result of this method is:

array(
    'Decided' => array('Yes' => '0', 'No' => '1'),
    'Undecided' => array('Maybe' => '2'),
)

Return Value

string[] The choice values
doc_Symfony
2016-10-28 06:08:40
Comments
Leave a Comment

Please login to continue.