Bonjour,

Je tente de créer un service pour mon formulaire... sans succès.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
parameters:
    site.contact.form.type.class: MyApp\siteBundle\Form\Type\Contact\ContactFormType
    site.contact.entity.class: MyApp\siteBundle\Entity\Contact
 
services:
    site.contact.form.type:
        class: %site.contact.form.type.class%
        arguments: [%site.contact.entity.class%]
        tags:
            -  { name: form.type }
 
    site.contact.form:
        class: Symfony\Component\Form\Form
        factory-service: form.factory
        factory-method: createNamed
        arguments: [ "@site.contact.form.type", "site.contact_form", "null"]
A priory je n'utilise pas la bonne classe:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
Catchable Fatal Error: Argument 1 passed to Symfony\Component\Form\Form::__construct() must be an instance of Symfony\Component\Form\FormConfigInterface, instance of MyApp\SiteBundle\Form\Type\Contact\ContactFormType given
Une idée ?

Merci.