Skip to content

Commit 2d1226a

Browse files
authored
Merge branch 'master' into patch-1
2 parents 54d5abb + 683ae1d commit 2d1226a

24 files changed

+78
-167
lines changed

Changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
Changelog
22
=========
33

4-
### 3.0.0 (2017-xx-xx)
4+
### 2.1.0 (2017-xx-xx)
5+
* Dropped Symfony < 2.8 support.
56

67
### 2.0.1 (2017-05-31)
78

DependencyInjection/Configuration.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace FOS\UserBundle\DependencyInjection;
1313

14-
use FOS\UserBundle\Util\LegacyFormHelper;
14+
use FOS\UserBundle\Form\Type;
1515
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
1616
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
1717
use Symfony\Component\Config\Definition\ConfigurationInterface;
@@ -101,7 +101,7 @@ private function addProfileSection(ArrayNodeDefinition $node)
101101
->addDefaultsIfNotSet()
102102
->fixXmlConfig('validation_group')
103103
->children()
104-
->scalarNode('type')->defaultValue(LegacyFormHelper::getType('FOS\UserBundle\Form\Type\ProfileFormType'))->end()
104+
->scalarNode('type')->defaultValue(Type\ProfileFormType::class)->end()
105105
->scalarNode('name')->defaultValue('fos_user_profile_form')->end()
106106
->arrayNode('validation_groups')
107107
->prototype('scalar')->end()
@@ -142,7 +142,7 @@ private function addRegistrationSection(ArrayNodeDefinition $node)
142142
->arrayNode('form')
143143
->addDefaultsIfNotSet()
144144
->children()
145-
->scalarNode('type')->defaultValue(LegacyFormHelper::getType('FOS\UserBundle\Form\Type\RegistrationFormType'))->end()
145+
->scalarNode('type')->defaultValue(Type\RegistrationFormType::class)->end()
146146
->scalarNode('name')->defaultValue('fos_user_registration_form')->end()
147147
->arrayNode('validation_groups')
148148
->prototype('scalar')->end()
@@ -184,7 +184,7 @@ private function addResettingSection(ArrayNodeDefinition $node)
184184
->arrayNode('form')
185185
->addDefaultsIfNotSet()
186186
->children()
187-
->scalarNode('type')->defaultValue(LegacyFormHelper::getType('FOS\UserBundle\Form\Type\ResettingFormType'))->end()
187+
->scalarNode('type')->defaultValue(Type\ResettingFormType::class)->end()
188188
->scalarNode('name')->defaultValue('fos_user_resetting_form')->end()
189189
->arrayNode('validation_groups')
190190
->prototype('scalar')->end()
@@ -211,7 +211,7 @@ private function addChangePasswordSection(ArrayNodeDefinition $node)
211211
->arrayNode('form')
212212
->addDefaultsIfNotSet()
213213
->children()
214-
->scalarNode('type')->defaultValue(LegacyFormHelper::getType('FOS\UserBundle\Form\Type\ChangePasswordFormType'))->end()
214+
->scalarNode('type')->defaultValue(Type\ChangePasswordFormType::class)->end()
215215
->scalarNode('name')->defaultValue('fos_user_change_password_form')->end()
216216
->arrayNode('validation_groups')
217217
->prototype('scalar')->end()
@@ -262,7 +262,7 @@ private function addGroupSection(ArrayNodeDefinition $node)
262262
->addDefaultsIfNotSet()
263263
->fixXmlConfig('validation_group')
264264
->children()
265-
->scalarNode('type')->defaultValue(LegacyFormHelper::getType('FOS\UserBundle\Form\Type\GroupFormType'))->end()
265+
->scalarNode('type')->defaultValue(Type\GroupFormType::class)->end()
266266
->scalarNode('name')->defaultValue('fos_user_group_form')->end()
267267
->arrayNode('validation_groups')
268268
->prototype('scalar')->end()

DependencyInjection/FOSUserExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function load(array $configs, ContainerBuilder $container)
6767
$definition->setFactory(array(new Reference('fos_user.doctrine_registry'), 'getManager'));
6868
}
6969

70-
foreach (array('validator', 'security', 'util', 'mailer', 'listeners') as $basename) {
70+
foreach (array('validator', 'security', 'util', 'mailer', 'listeners', 'commands') as $basename) {
7171
$loader->load(sprintf('%s.xml', $basename));
7272
}
7373

Form/Type/ChangePasswordFormType.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111

1212
namespace FOS\UserBundle\Form\Type;
1313

14-
use FOS\UserBundle\Util\LegacyFormHelper;
1514
use Symfony\Component\Form\AbstractType;
15+
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
16+
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
1617
use Symfony\Component\Form\FormBuilderInterface;
1718
use Symfony\Component\OptionsResolver\OptionsResolver;
1819
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
@@ -46,7 +47,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
4647
$constraintsOptions['groups'] = array(reset($options['validation_groups']));
4748
}
4849

49-
$builder->add('current_password', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\PasswordType'), array(
50+
$builder->add('current_password', PasswordType::class, array(
5051
'label' => 'form.current_password',
5152
'translation_domain' => 'FOSUserBundle',
5253
'mapped' => false,
@@ -56,8 +57,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
5657
),
5758
));
5859

59-
$builder->add('plainPassword', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\RepeatedType'), array(
60-
'type' => LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\PasswordType'),
60+
$builder->add('plainPassword', RepeatedType::class, array(
61+
'type' => PasswordType::class,
6162
'options' => array('translation_domain' => 'FOSUserBundle'),
6263
'first_options' => array('label' => 'form.new_password'),
6364
'second_options' => array('label' => 'form.new_password_confirmation'),
@@ -73,8 +74,6 @@ public function configureOptions(OptionsResolver $resolver)
7374
$resolver->setDefaults(array(
7475
'data_class' => $this->class,
7576
'csrf_token_id' => 'change_password',
76-
// BC for SF < 2.8
77-
'intention' => 'change_password',
7877
));
7978
}
8079

Form/Type/GroupFormType.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ public function configureOptions(OptionsResolver $resolver)
4646
$resolver->setDefaults(array(
4747
'data_class' => $this->class,
4848
'csrf_token_id' => 'group',
49-
// BC for SF < 2.8
50-
'intention' => 'group',
5149
));
5250
}
5351

Form/Type/ProfileFormType.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111

1212
namespace FOS\UserBundle\Form\Type;
1313

14-
use FOS\UserBundle\Util\LegacyFormHelper;
1514
use Symfony\Component\Form\AbstractType;
15+
use Symfony\Component\Form\Extension\Core\Type\EmailType;
16+
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
1617
use Symfony\Component\Form\FormBuilderInterface;
1718
use Symfony\Component\OptionsResolver\OptionsResolver;
1819
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
@@ -48,7 +49,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
4849
$constraintsOptions['groups'] = array(reset($options['validation_groups']));
4950
}
5051

51-
$builder->add('current_password', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\PasswordType'), array(
52+
$builder->add('current_password', PasswordType::class, array(
5253
'label' => 'form.current_password',
5354
'translation_domain' => 'FOSUserBundle',
5455
'mapped' => false,
@@ -67,8 +68,6 @@ public function configureOptions(OptionsResolver $resolver)
6768
$resolver->setDefaults(array(
6869
'data_class' => $this->class,
6970
'csrf_token_id' => 'profile',
70-
// BC for SF < 2.8
71-
'intention' => 'profile',
7271
));
7372
}
7473

@@ -99,7 +98,7 @@ protected function buildUserForm(FormBuilderInterface $builder, array $options)
9998
{
10099
$builder
101100
->add('username', null, array('label' => 'form.username', 'translation_domain' => 'FOSUserBundle'))
102-
->add('email', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\EmailType'), array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle'))
101+
->add('email', EmailType::class, array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle'))
103102
;
104103
}
105104
}

Form/Type/RegistrationFormType.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111

1212
namespace FOS\UserBundle\Form\Type;
1313

14-
use FOS\UserBundle\Util\LegacyFormHelper;
1514
use Symfony\Component\Form\AbstractType;
15+
use Symfony\Component\Form\Extension\Core\Type\EmailType;
16+
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
17+
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
1618
use Symfony\Component\Form\FormBuilderInterface;
1719
use Symfony\Component\OptionsResolver\OptionsResolver;
1820

@@ -37,10 +39,10 @@ public function __construct($class)
3739
public function buildForm(FormBuilderInterface $builder, array $options)
3840
{
3941
$builder
40-
->add('email', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\EmailType'), array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle'))
42+
->add('email', EmailType::class, array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle'))
4143
->add('username', null, array('label' => 'form.username', 'translation_domain' => 'FOSUserBundle'))
42-
->add('plainPassword', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\RepeatedType'), array(
43-
'type' => LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\PasswordType'),
44+
->add('plainPassword', RepeatedType::class, array(
45+
'type' => PasswordType::class,
4446
'options' => array('translation_domain' => 'FOSUserBundle'),
4547
'first_options' => array('label' => 'form.password'),
4648
'second_options' => array('label' => 'form.password_confirmation'),
@@ -57,8 +59,6 @@ public function configureOptions(OptionsResolver $resolver)
5759
$resolver->setDefaults(array(
5860
'data_class' => $this->class,
5961
'csrf_token_id' => 'registration',
60-
// BC for SF < 2.8
61-
'intention' => 'registration',
6262
));
6363
}
6464

Form/Type/ResettingFormType.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111

1212
namespace FOS\UserBundle\Form\Type;
1313

14-
use FOS\UserBundle\Util\LegacyFormHelper;
1514
use Symfony\Component\Form\AbstractType;
15+
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
16+
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
1617
use Symfony\Component\Form\FormBuilderInterface;
1718
use Symfony\Component\OptionsResolver\OptionsResolver;
1819

@@ -36,8 +37,8 @@ public function __construct($class)
3637
*/
3738
public function buildForm(FormBuilderInterface $builder, array $options)
3839
{
39-
$builder->add('plainPassword', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\RepeatedType'), array(
40-
'type' => LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\PasswordType'),
40+
$builder->add('plainPassword', RepeatedType::class, array(
41+
'type' => PasswordType::class,
4142
'options' => array('translation_domain' => 'FOSUserBundle'),
4243
'first_options' => array('label' => 'form.new_password'),
4344
'second_options' => array('label' => 'form.new_password_confirmation'),
@@ -53,8 +54,6 @@ public function configureOptions(OptionsResolver $resolver)
5354
$resolver->setDefaults(array(
5455
'data_class' => $this->class,
5556
'csrf_token_id' => 'resetting',
56-
// BC for SF < 2.8
57-
'intention' => 'resetting',
5857
));
5958
}
6059

Form/Type/UsernameFormType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace FOS\UserBundle\Form\Type;
1313

1414
use FOS\UserBundle\Form\DataTransformer\UserToUsernameTransformer;
15-
use FOS\UserBundle\Util\LegacyFormHelper;
1615
use Symfony\Component\Form\AbstractType;
16+
use Symfony\Component\Form\Extension\Core\Type\TextType;
1717
use Symfony\Component\Form\FormBuilderInterface;
1818

1919
/**
@@ -51,7 +51,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
5151
*/
5252
public function getParent()
5353
{
54-
return LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\TextType');
54+
return TextType::class;
5555
}
5656

5757
// BC for SF < 3.0

Resources/config/commands.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
6+
7+
<services>
8+
<service id="fos_user.command.activate_user" class="FOS\UserBundle\Command\ActivateUserCommand">
9+
<tag name="console.command" command="fos:user:activate" />
10+
</service>
11+
<service id="fos_user.command.change_password" class="FOS\UserBundle\Command\ChangePasswordCommand">
12+
<tag name="console.command" command="fos:user:change-password" />
13+
</service>
14+
<service id="fos_user.command.create_user" class="FOS\UserBundle\Command\CreateUserCommand">
15+
<tag name="console.command" command="fos:user:create" />
16+
</service>
17+
<service id="fos_user.command.deactivate_user" class="FOS\UserBundle\Command\DeactivateUserCommand">
18+
<tag name="console.command" command="fos:user:deactivate" />
19+
</service>
20+
<service id="fos_user.command.demote_user" class="FOS\UserBundle\Command\DemoteUserCommand">
21+
<tag name="console.command" command="fos:user:demote" />
22+
</service>
23+
<service id="fos_user.command.promote_user" class="FOS\UserBundle\Command\PromoteUserCommand">
24+
<tag name="console.command" command="fos:user:promote" />
25+
</service>
26+
</services>
27+
28+
</container>

0 commit comments

Comments
 (0)