Symfony2.8-> 3.3 Sonata \ CoreBundle \ Form \ Extension \ DependencyInjectionExtension :: __ construct()必须为数组类型,给定对象,在

时间:2018-11-19 15:18:26

标签: php symfony

我更新了交响乐2.8-> 3.3

现在,首页看起来正常。 但是,当我加载使用表单生成器的页面时,我遇到了这个错误。

  

类型错误:参数3传递给   Sonata \ CoreBundle \ Form \ Extension \ DependencyInjectionExtension :: __ construct()   必须是数组类型,给定对象,在   /Users/whitebear/CodingWorks/httproot/myapp/var/cache/dev/appDevDebugProjectContainer.php   在第1325行

尽管我认为这与服务容器有关,但我不知道应该在哪里修复。

我在做什么像下面这样

$em = $this->getDoctrine()->getManager();
$reqDoc = new reqDoc();
$form = $this->createFormBuilder($reqDoc)

错误消息在下面

  

DependencyInjectionExtension-> __ construct(object(appDevDebugProjectContainer),array('Symfony \ Component \ Form \ Extension \ Core \ Type \ FormType'   =>对象(RewindableGenerator),'Symfony \ Component \ Form \ Extension \ Core \ Type \ RepeatedType'   =>对象(RewindableGenerator),'Symfony \ Component \ Form \ Extension \ Core \ Type \ SubmitType'   =>对象(RewindableGenerator),'Symfony \ Component \ Form \ Extension \ Core \ Type \ ChoiceType'   =>对象(RewindableGenerator),对象(RewindableGenerator),null,array('sonata_type_admin'   =>'Sonata \ AdminBundle \ Form \ Type \ AdminType','sonata_type_model'=>'Sonata \ AdminBundle \ Form \ Type \ ModelType','sonata_type_model_list'=>   'Sonata \ AdminBundle \ Form \ Type \ ModelTypeList',   'sonata_type_model_reference'=>   'Sonata \ AdminBundle \ Form \ Type \ ModelReferenceType',   'sonata_type_model_hidden'=>   'Sonata \ AdminBundle \ Form \ Type \ ModelHiddenType',   'sonata_type_model_autocomplete'=>   'Sonata \ AdminBundle \ Form \ Type \ ModelAutocompleteType',   'sonata_type_native_collection'=>   'Sonata \ AdminBundle \ Form \ Type \ CollectionType',   'sonata_type_choice_field_mask'=>   'Sonata \ AdminBundle \ Form \ Type \ ChoiceFieldMaskType',   'sonata_type_filter_number'=>   'Sonata \ AdminBundle \ Form \ Type \ Filter \ NumberType',   'sonata_type_filter_choice'=>   'Sonata \ AdminBundle \ Form \ Type \ Filter \ ChoiceType',   'sonata_type_filter_default'=>   'Sonata \ AdminBundle \ Form \ Type \ Filter \ DefaultType',   'sonata_type_filter_date'=>   'Sonata \ AdminBundle \ Form \ Type \ Filter \ DateType',   'sonata_type_filter_date_range'=>   'Sonata \ AdminBundle \ Form \ Type \ Filter \ DateRangeType',   'sonata_type_filter_datetime'=>   'Sonata \ AdminBundle \ Form \ Type \ Filter \ DateTimeType',   'sonata_type_filter_datetime_range'=>   'Sonata \ AdminBundle \ Form \ Type \ Filter \ DateTimeRangeType','tab'=>   'Mopa \ Bundle \ BootstrapBundle \ Form \ Type \ TabType',   'sonata_block_service_choice'=>   'Sonata \ BlockBundle \ Form \ Type \ ServiceListType',   'sonata_type_container_template_choice'=>   'Sonata \ BlockBundle \ Form \ Type \ ContainerTemplateType','form'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ FormType',   '生日'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ BirthdayType',   '复选框'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ CheckboxType',   '选择'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ ChoiceType',   '收藏'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ CollectionType',   '国家'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ CountryType','date'   =>'Symfony \ Component \ Form \ Extension \ Core \ Type \ DateType','datetime'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ DateTimeType',   '电子邮件'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ EmailType','file'   =>'Symfony \ Component \ Form \ Extension \ Core \ Type \ FileType','hidden'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ HiddenType',   '整数'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ IntegerType',   '语言'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ LanguageType',   'locale'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ LocaleType','money'   =>'Symfony \ Component \ Form \ Extension \ Core \ Type \ MoneyType','number'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ NumberType',   '密码'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ PasswordType',   '百分比'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ PercentType',   'radio'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ RadioType',   '重复'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ RepeatedType',   '搜索'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ SearchType',   'textarea'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ TextareaType',   '文本'=>'Symfony \ Component \ Form \ Extension \ Core \ Type \ TextType',   '时间'=>'Symfony \ Component \ Form \ Extension \ Core \ Type \ TimeType',   '时区'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ TimezoneType','url'   =>'Symfony \ Component \ Form \ Extension \ Core \ Type \ UrlType','button'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ ButtonType',   '提交'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ SubmitType','重置'   =>'Symfony \ Component \ Form \ Extension \ Core \ Type \ ResetType','currency'=>   'Symfony \ Component \ Form \ Extension \ Core \ Type \ CurrencyType',   '实体'=>'Symfony \ Bridge \ Doctrine \ Form \ Type \ EntityType',   'sonata_type_immutable_array'=>   'Sonata \ CoreBundle \ Form \ Type \ ImmutableArrayType',   'sonata_type_boolean'=>   'Sonata \ CoreBundle \ Form \ Type \ BooleanType',   'sonata_type_collection'=>   'Sonata \ CoreBundle \ Form \ Type \ CollectionType',   'sonata_type_translatable_choice'=>   'Sonata \ CoreBundle \ Form \ Type \ TranslatableChoiceType',   'sonata_type_date_range'=>   'Sonata \ CoreBundle \ Form \ Type \ DateRangeType',   'sonata_type_datetime_range'=>   'Sonata \ CoreBundle \ Form \ Type \ DateTimeRangeType',   'sonata_type_date_picker'=>   'Sonata \ CoreBundle \ Form \ Type \ DatePickerType',   'sonata_type_datetime_picker'=>   'Sonata \ CoreBundle \ Form \ Type \ DateTimePickerType',   'sonata_type_date_range_picker'=>   'Sonata \ CoreBundle \ Form \ Type \ DateRangePickerType',   'sonata_type_datetime_range_picker'=>   'Sonata \ CoreBundle \ Form \ Type \ DateTimeRangePickerType',   'sonata_type_equal'=>'Sonata \ CoreBundle \ Form \ Type \ EqualType',   'sonata_type_color_selector'=>   'Sonata \ CoreBundle \ Form \ Type \ ColorSelectorType'),数组('form'   => array('sonata.admin.form.extension.field','mopa_bootstrap.form.type_extension.help',   'mopa_bootstrap.form.type_extension.legend',   'mopa_bootstrap.form.type_extension.error',   'mopa_bootstrap.form.type_extension.widget',   'mopa_bootstrap.form.type_extension.horizo​​ntal',   'mopa_bootstrap.form.type_extension.widget_collection',   'mopa_bootstrap.form.type_extension.tabbed',   'form.type_extension.form.http_foundation',   'form.type_extension.form.validator','form.type_extension.csrf',   'form.type_extension.form.data_collector'),'选择'   => array('sonata.admin.form.extension.choice'),'button'=> array('mopa_bootstrap.form.type_extension.button'),'date'=> array('mopa_bootstrap.form.type_extension.date '),'repeated'=> array('form.type_extension.repeated.validator'),'submit'=> array('form.type_extension.submit.validator')),array())       在var / cache / dev / appDevDebugProjectContainer.php(第1325行)

1 个答案:

答案 0 :(得分:1)

以下是我在评论中提到的答案:

可能您还必须升级您的SonataCoreBundle依赖版本。也许这与Symfony 3.3不兼容。