我在 Symfony 2.2 中我想通过服务创建一个小联系表。我玩弄了服务配置和表单组件工厂,但每次我遇到以下异常:
An exception has been thrown during the rendering of a template ("Catchable Fatal Error: Argument 1 passed to Symfony\Component\Form\Form::__construct() must be an instance of Symfony\Component\Form\FormConfigInterface, string given
parameters:
anchorbrands_common.contact.form.type.class: Anchorbrands\Bundle\CommonBundle\Form\Type\ContactFormType
anchorbrands_common.contact.form.name: anchorbrands_commonbundle_contactformtype
services:
anchorbrands_common.footer.contact.form:
class: Symfony\Component\Form\Form
factory-method: createNamed
factory-service: form.factory
arguments: ["%anchorbrands_common.contact.form.type.class%", "null"]
anchorbrands_common.footer.contact.form.type:
class: %anchorbrands_common.contact.form.type.class%
arguments: ["null"]
tags:
- { name: form.type, alias: %anchorbrands_common.contact.form.name% }
如果有人能给我一些建议,那就太好了,谢谢。