Skip to content
Advertisement

Symfony2.8 -> 3.3 SonataCoreBundleFormExtensionDependencyInjectionExtension::__construct() must be of the type array, object given, called in

I have updated symfony 2.8 -> 3.3

Now Top page looks working. However when I load the page where uses form builder I burped into this error.

Type error: Argument 3 passed to SonataCoreBundleFormExtensionDependencyInjectionExtension::__construct() must be of the type array, object given, called in /Users/whitebear/CodingWorks/httproot/myapp/var/cache/dev/appDevDebugProjectContainer.php on line 1325

I think this is related to service container though, I can’t figure out where should I fix.

What I am doing is like this below

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

error messages is below

DependencyInjectionExtension->__construct(object(appDevDebugProjectContainer), array(‘SymfonyComponentFormExtensionCoreTypeFormType’ =>object(RewindableGenerator), ‘SymfonyComponentFormExtensionCoreTypeRepeatedType’ => object(RewindableGenerator), ‘SymfonyComponentFormExtensionCoreTypeSubmitType’ => object(RewindableGenerator), ‘SymfonyComponentFormExtensionCoreTypeChoiceType’ => object(RewindableGenerator)), object(RewindableGenerator), null,array(‘sonata_type_admin’ => ‘SonataAdminBundleFormTypeAdminType’, ‘sonata_type_model’ => ‘SonataAdminBundleFormTypeModelType’, ‘sonata_type_model_list’ => ‘SonataAdminBundleFormTypeModelTypeList’, ‘sonata_type_model_reference’ => ‘SonataAdminBundleFormTypeModelReferenceType’, ‘sonata_type_model_hidden’ => ‘SonataAdminBundleFormTypeModelHiddenType’, ‘sonata_type_model_autocomplete’ => ‘SonataAdminBundleFormTypeModelAutocompleteType’, ‘sonata_type_native_collection’ => ‘SonataAdminBundleFormTypeCollectionType’, ‘sonata_type_choice_field_mask’ => ‘SonataAdminBundleFormTypeChoiceFieldMaskType’, ‘sonata_type_filter_number’ => ‘SonataAdminBundleFormTypeFilterNumberType’, ‘sonata_type_filter_choice’ => ‘SonataAdminBundleFormTypeFilterChoiceType’, ‘sonata_type_filter_default’ => ‘SonataAdminBundleFormTypeFilterDefaultType’, ‘sonata_type_filter_date’ => ‘SonataAdminBundleFormTypeFilterDateType’, ‘sonata_type_filter_date_range’ => ‘SonataAdminBundleFormTypeFilterDateRangeType’, ‘sonata_type_filter_datetime’ => ‘SonataAdminBundleFormTypeFilterDateTimeType’, ‘sonata_type_filter_datetime_range’ => ‘SonataAdminBundleFormTypeFilterDateTimeRangeType’, ‘tab’ => ‘MopaBundleBootstrapBundleFormTypeTabType’, ‘sonata_block_service_choice’ => ‘SonataBlockBundleFormTypeServiceListType’, ‘sonata_type_container_template_choice’ => ‘SonataBlockBundleFormTypeContainerTemplateType’, ‘form’ => ‘SymfonyComponentFormExtensionCoreTypeFormType’, ‘birthday’ => ‘SymfonyComponentFormExtensionCoreTypeBirthdayType’, ‘checkbox’ => ‘SymfonyComponentFormExtensionCoreTypeCheckboxType’, ‘choice’ => ‘SymfonyComponentFormExtensionCoreTypeChoiceType’, ‘collection’ => ‘SymfonyComponentFormExtensionCoreTypeCollectionType’, ‘country’ => ‘SymfonyComponentFormExtensionCoreTypeCountryType’, ‘date’ => ‘SymfonyComponentFormExtensionCoreTypeDateType’, ‘datetime’ => ‘SymfonyComponentFormExtensionCoreTypeDateTimeType’, ’email’ => ‘SymfonyComponentFormExtensionCoreTypeEmailType’, ‘file’ => ‘SymfonyComponentFormExtensionCoreTypeFileType’, ‘hidden’ => ‘SymfonyComponentFormExtensionCoreTypeHiddenType’, ‘integer’ => ‘SymfonyComponentFormExtensionCoreTypeIntegerType’, ‘language’ => ‘SymfonyComponentFormExtensionCoreTypeLanguageType’, ‘locale’ => ‘SymfonyComponentFormExtensionCoreTypeLocaleType’, ‘money’ => ‘SymfonyComponentFormExtensionCoreTypeMoneyType’, ‘number’ => ‘SymfonyComponentFormExtensionCoreTypeNumberType’, ‘password’ => ‘SymfonyComponentFormExtensionCoreTypePasswordType’, ‘percent’ => ‘SymfonyComponentFormExtensionCoreTypePercentType’, ‘radio’ => ‘SymfonyComponentFormExtensionCoreTypeRadioType’, ‘repeated’ => ‘SymfonyComponentFormExtensionCoreTypeRepeatedType’, ‘search’ => ‘SymfonyComponentFormExtensionCoreTypeSearchType’, ‘textarea’ => ‘SymfonyComponentFormExtensionCoreTypeTextareaType’, ‘text’ => ‘SymfonyComponentFormExtensionCoreTypeTextType’, ‘time’ => ‘SymfonyComponentFormExtensionCoreTypeTimeType’, ‘timezone’ => ‘SymfonyComponentFormExtensionCoreTypeTimezoneType’, ‘url’ => ‘SymfonyComponentFormExtensionCoreTypeUrlType’, ‘button’ => ‘SymfonyComponentFormExtensionCoreTypeButtonType’, ‘submit’ => ‘SymfonyComponentFormExtensionCoreTypeSubmitType’, ‘reset’ => ‘SymfonyComponentFormExtensionCoreTypeResetType’, ‘currency’ => ‘SymfonyComponentFormExtensionCoreTypeCurrencyType’, ‘entity’ => ‘SymfonyBridgeDoctrineFormTypeEntityType’, ‘sonata_type_immutable_array’ => ‘SonataCoreBundleFormTypeImmutableArrayType’, ‘sonata_type_boolean’ => ‘SonataCoreBundleFormTypeBooleanType’, ‘sonata_type_collection’ => ‘SonataCoreBundleFormTypeCollectionType’, ‘sonata_type_translatable_choice’ => ‘SonataCoreBundleFormTypeTranslatableChoiceType’, ‘sonata_type_date_range’ => ‘SonataCoreBundleFormTypeDateRangeType’, ‘sonata_type_datetime_range’ => ‘SonataCoreBundleFormTypeDateTimeRangeType’, ‘sonata_type_date_picker’ => ‘SonataCoreBundleFormTypeDatePickerType’, ‘sonata_type_datetime_picker’ => ‘SonataCoreBundleFormTypeDateTimePickerType’, ‘sonata_type_date_range_picker’ => ‘SonataCoreBundleFormTypeDateRangePickerType’, ‘sonata_type_datetime_range_picker’ => ‘SonataCoreBundleFormTypeDateTimeRangePickerType’, ‘sonata_type_equal’ => ‘SonataCoreBundleFormTypeEqualType’, ‘sonata_type_color_selector’ => ‘SonataCoreBundleFormTypeColorSelectorType’), array(‘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.horizontal’, ‘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’), ‘choice’ =>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()) in var/cache/dev/appDevDebugProjectContainer.php (line 1325)

Advertisement

Answer

Here my answer mentioned in the comments:

Probably you have to upgrade your SonataCoreBundle dependency version as well. Maybe this one is not compatible with Symfony 3.3.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement