Skip to content

Commit 60065a3

Browse files
committed
[Form] Deprecated FormTypeInterface::getName() and passing of type instances
1 parent fe1980d commit 60065a3

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class LoginController extends ContainerAware
1919
{
2020
public function loginAction()
2121
{
22-
$form = $this->container->get('form.factory')->create('user_login');
22+
$form = $this->container->get('form.factory')->create('Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginType');
2323

2424
return $this->container->get('templating')->renderResponse('CsrfFormLoginBundle:Login:login.html.twig', array(
2525
'form' => $form->createView(),

Tests/Functional/Bundle/CsrfFormLoginBundle/Form/UserLoginFormType.php renamed to Tests/Functional/Bundle/CsrfFormLoginBundle/Form/UserLoginType.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* @author Henrik Bjornskov <[email protected]>
2828
* @author Jeremy Mikola <[email protected]>
2929
*/
30-
class UserLoginFormType extends AbstractType
30+
class UserLoginType extends AbstractType
3131
{
3232
private $requestStack;
3333

@@ -45,9 +45,9 @@ public function __construct(RequestStack $requestStack)
4545
public function buildForm(FormBuilderInterface $builder, array $options)
4646
{
4747
$builder
48-
->add('username', 'text')
49-
->add('password', 'password')
50-
->add('_target_path', 'hidden')
48+
->add('username', 'Symfony\Component\Form\Extension\Core\Type\TextType')
49+
->add('password', 'Symfony\Component\Form\Extension\Core\Type\PasswordType')
50+
->add('_target_path', 'Symfony\Component\Form\Extension\Core\Type\HiddenType')
5151
;
5252

5353
$request = $this->requestStack->getCurrentRequest();
@@ -87,12 +87,4 @@ public function configureOptions(OptionsResolver $resolver)
8787
'intention' => 'authenticate',
8888
));
8989
}
90-
91-
/**
92-
* {@inheritdoc}
93-
*/
94-
public function getName()
95-
{
96-
return 'user_login';
97-
}
9890
}

Tests/Functional/app/CsrfFormLogin/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ imports:
33

44
services:
55
csrf_form_login.form.type:
6-
class: Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginFormType
6+
class: Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginType
77
arguments:
88
- @request_stack
99
tags:
10-
- { name: form.type, alias: user_login }
10+
- { name: form.type }
1111

1212
security:
1313
encoders:

0 commit comments

Comments
 (0)