2

我收到以下错误

The option "label " does not exist. Known options are: "always_empty", "attr", "block_name", "by_reference", "cascade_validation", "compound", "constraints", "csrf_field_name", "csrf_protection", "csrf_provider", "data", "data_class", "disabled", "empty_data", "error_bubbling", "error_mapping", "extra_fields_message", "intention", "invalid_message", "invalid_message_parameters", "label", "label_attr", "mapped", "max_length", "pattern", "post_max_size_message", "property_path", "read_only", "required", "translation_domain", "trim", "validation_constraint", "validation_groups", "virtual"

尽管在文档中他们说它有一个label选项。

我的代码如下:

namespace ....

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class AddNew extends AbstractType
{
    private $languages;
    public function __construct($languages){
        $this->languages = $languages;
    }
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        echo "<pre>";//debugging
        print_r($this->languages);//debugging
        $builder->add('Key');
        foreach ($this->languages as $key => $language){
        $builder->add('translation'.$key, 'password' , array('label '=>$language['description'].' translation'));

        }
    }
 some other irrelevant stuff ......
}
4

1 回答 1

3

看起来你在那里有一个额外的空间:"label ""label".

于 2013-02-20T07:16:05.700 回答