propelorm / PropelBundle

PropelBundle for Symfony.
http://propelorm.org/Propel/documentation/#working-with-symfony2
180 stars 156 forks source link

1.5.2 > update in model form type declaration? #457

Closed lionelbzv closed 6 years ago

lionelbzv commented 7 years ago

Env: SF2.8+PropelBundle1.5.2

Since the migration from v1.5.1 to v1.5.2, I've got errors if I try to create 'model' form type:

        $builder->add('foo', 'model', array(
            'class' => 'Project\\Model\\Foo',
        ));

I've now got to use:

        $builder->add('foo', 'Propel\Bundle\PropelBundle\Form\Type\ModelType', array(
            'class' => 'Project\\Model\\Foo',
        ));

I've noticed that a BC patch could be to restore the method getName in ModelType, is it normal that it has been deleted?

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'model';
    }

Or what's the "right" way to declare a model form type now?

Thanks.

jwong-dayspring commented 6 years ago

@Lionel09 As of Symfony 2.8, the proper way to declare a form type is to use the fully-qualified class name.

New in version 2.8: To denote the form type, you have to use the fully qualified class name - like TextType::class in PHP 5.5+ or Symfony\Component\Form\Extension\Core\Type\TextType. Before Symfony 2.8, you could use an alias for each type like text or date. The old alias syntax will still work until Symfony 3.0. For more details, see the 2.8 UPGRADE Log.

https://symfony.com/doc/2.8/forms.html#building-the-form