Skip to content

[Form] Reverse order of $name and $type in FormFactory::createNamed* #4342

Closed
@webmozart

Description

@webmozart

Currently, the createNamed* methods of FormFactoryInterface are defined like this:

function createNamed($type, $name, $data = null, array $options = array(), FormBuilder $parent = null);
function createNamedBuilder($type, $name, $data = null, array $options = array(), FormBuilder $parent = null);

This is very confusing since the parameters $type and $name are defined in FormBuilder::add() in the exact opposite order:

$builder->add('field', 'text');
// but:
$form = $factory->createNamed('text', 'field');

I think that the order of the parameters should be switched in order to make usage of the FormFactory methods more intuitive. This would break BC.

Thoughts?

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