8000 FormType dependency injection · Issue #17592 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
FormType dependency injection #17592
Closed
Closed
@tamasnyulas

Description

@tamasnyulas

In Symfony 3 there's no other way to add dependencies to form types, then defining them as services. Those who want to use the form bundle stand alone, have no chance to have some dependency injected to the type, since Symfony itself handles the instantiation inside the form factory.

I'd like to suggest to let the clients use an instance of a FormTypeInterface as the first parameter in the FormFactory::create() method (or an FQCN string as it's now) and internally don't create other instance of the type. This way whenever you need the FQCN you can have it with get_class($formType), but client's still able to provide their own dependencies without registering services.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0