如何在php 5.4中使用Symfony 2.7 ChoiceType?

时间:2016-01-02 22:32:36

标签: php symfony

我正在尝试将Symfony更新为2.7 API for choiceList。 symfony manual有例子:

$builder->add('isAttending', ChoiceType::class, array(

对于PHP 5.4我翻译为

$builder->add('graduatedSince', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array(

但是,我收到“无法加载类型”错误。语法是什么?

1 个答案:

答案 0 :(得分:2)

Symfony 2.7的语法是

toolTipListBox1.Items.AddRange(WindowSnap.GetAllWindows(true, true).Select(wnd => 
{
    string listBoxItemText = wnd.ToString();
    return new ListBoxItem(listBoxItemText, listBoxItemText);
}).ToArray());

以下是documentation