@@ -94,11 +94,12 @@ Next, create the form for the ``User`` model::
94
94
namespace Acme\AccountBundle\Form\Type;
95
95
96
96
use Symfony\Component\Form\AbstractType;
97
- use Symfony\Component\Form\FormBuilder;
97
+ use Symfony\Component\Form\FormBuilderInterface;
98
+ use Symfony\Component\OptionsResolver\OptionsResolverInterface;
98
99
99
100
class UserType extends AbstractType
100
101
{
101
- public function buildForm(FormBuilder $builder, array $options)
102
+ public function buildForm(FormBuilderInterface $builder, array $options)
102
103
{
103
104
$builder->add('email', 'email');
104
105
$builder->add('plainPassword', 'repeated', array(
@@ -108,9 +109,11 @@ Next, create the form for the ``User`` model::
108
109
));
109
110
}
110
111
111
- public function getDefaultOptions(array $options )
112
+ public function setDefaultOptions(OptionsResolverInterface $resolver )
112
113
{
113
- return array('data_class' => 'Acme\AccountBundle\Entity\User');
114
+ $resolver->setDefaults(array(
115
+ 'data_class' => 'Acme\AccountBundle\Entity\User'
116
+ ));
114
117
}
115
118
116
119
public function getName()
@@ -184,11 +187,11 @@ Next, create the form for this ``Registration`` model::
184
187
namespace Acme\AccountBundle\Form\Type;
185
188
186
189
use Symfony\Component\Form\AbstractType;
187
- use Symfony\Component\Form\FormBuilder ;
190
+ use Symfony\Component\Form\FormBuilderInterface ;
188
191
189
192
class RegistrationType extends AbstractType
190
193
{
191
- public function buildForm(FormBuilder $builder, array $options)
194
+ public function buildForm(FormBuilderInterface $builder, array $options)
192
195
{
193
196
$builder->add('user', new UserType());
194
197
$builder->add('terms', 'checkbox', array('property_path' => 'termsAccepted'));
@@ -250,7 +253,7 @@ the validation and saves the data into the database::
250
253
251
254
$form = $this->createForm(new RegistrationType(), new Registration());
252
255
253
- $form->bindRequest ($this->getRequest());
256
+ $form->bind ($this->getRequest());
254
257
255
258
if ($form->isValid()) {
256
259
$registration = $form->getData();
0 commit comments