Skip to content

Revert: [make:form] suffix with "Form" instead of "Type" #1685 #1711

Closed
@lyrixx

Description

@lyrixx

Hello, I'm late on this one.

refs #1685


I used it for few days, and I don't like it.
I just renamed everything in [Name]Type back

Almost everything in Symfony is a Type

Extends

class SiteType extends AbstractType

It's weird to have such missmatch:

class SiteForm extends AbstractType

Composition

public function buildForm(FormBuilderInterface $builder, array $options): void
{
    $builder
        ->add('name', TextType::class)
        ->add('my_csutom_thing', CustomForm::class)

There is a mismatch here too

Extension

There is a mismatch here too

class NoValidateExtension extends AbstractTypeExtension
{

    public static function getExtendedTypes(): iterable
    {
        yield CustomForm::class;
    }
}

Abstract Controller

abstract class AbstractController implements ServiceSubscriberInterface
    /**
     * Creates and returns a Form instance from the type of the form.
     */
    protected function createForm(string $type, mixed $data = null, array $options = []): FormInterface
  • from the type
  • string $type

View

In the view, now the input name are suffixed with form

Before with RegisterForm
After With RegisterType

-        $form['register_form[name]'] = 'John Doe';
-        $form['register_form[email]'] = $emailAddress = faker()->email();
-        $form['register_form[password]'] = 'My Super Secret Password';
+        $form['register[name]'] = 'John Doe';
+        $form['register[email]'] = $emailAddress = faker()->email();
+        $form['register[password]'] = 'My Super Secret Password';

I'm pretty sure there are more mismatch, but it's already enough for me to change locally what the maker make.

see also #1697

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions