Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ matrix:
env: TARGET=cs_dry_run
- php: 5.5
env: COMPOSER_FLAGS="--prefer-lowest"
- php: 5.6
env: SYMFONY_VERSION=2.7.*
- php: 5.6
env: SYMFONY_VERSION=2.8.*
allow_failures:
Expand Down
3 changes: 2 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Changelog
=========

### 3.0.0 (2017-xx-xx)
### 2.1.0 (2017-xx-xx)
* Dropped Symfony < 2.8 support.

### 2.0.1 (2017-05-31)

Expand Down
12 changes: 6 additions & 6 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace FOS\UserBundle\DependencyInjection;

use FOS\UserBundle\Util\LegacyFormHelper;
use FOS\UserBundle\Form\Type;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
Expand Down Expand Up @@ -101,7 +101,7 @@ private function addProfileSection(ArrayNodeDefinition $node)
->addDefaultsIfNotSet()
->fixXmlConfig('validation_group')
->children()
->scalarNode('type')->defaultValue(LegacyFormHelper::getType('FOS\UserBundle\Form\Type\ProfileFormType'))->end()
->scalarNode('type')->defaultValue(Type\ProfileFormType::class)->end()
->scalarNode('name')->defaultValue('fos_user_profile_form')->end()
->arrayNode('validation_groups')
->prototype('scalar')->end()
Expand Down Expand Up @@ -142,7 +142,7 @@ private function addRegistrationSection(ArrayNodeDefinition $node)
->arrayNode('form')
->addDefaultsIfNotSet()
->children()
->scalarNode('type')->defaultValue(LegacyFormHelper::getType('FOS\UserBundle\Form\Type\RegistrationFormType'))->end()
->scalarNode('type')->defaultValue(Type\RegistrationFormType::class)->end()
->scalarNode('name')->defaultValue('fos_user_registration_form')->end()
->arrayNode('validation_groups')
->prototype('scalar')->end()
Expand Down Expand Up @@ -184,7 +184,7 @@ private function addResettingSection(ArrayNodeDefinition $node)
->arrayNode('form')
->addDefaultsIfNotSet()
->children()
->scalarNode('type')->defaultValue(LegacyFormHelper::getType('FOS\UserBundle\Form\Type\ResettingFormType'))->end()
->scalarNode('type')->defaultValue(Type\ResettingFormType::class)->end()
->scalarNode('name')->defaultValue('fos_user_resetting_form')->end()
->arrayNode('validation_groups')
->prototype('scalar')->end()
Expand All @@ -211,7 +211,7 @@ private function addChangePasswordSection(ArrayNodeDefinition $node)
->arrayNode('form')
->addDefaultsIfNotSet()
->children()
->scalarNode('type')->defaultValue(LegacyFormHelper::getType('FOS\UserBundle\Form\Type\ChangePasswordFormType'))->end()
->scalarNode('type')->defaultValue(Type\ChangePasswordFormType::class)->end()
->scalarNode('name')->defaultValue('fos_user_change_password_form')->end()
->arrayNode('validation_groups')
->prototype('scalar')->end()
Expand Down Expand Up @@ -262,7 +262,7 @@ private function addGroupSection(ArrayNodeDefinition $node)
->addDefaultsIfNotSet()
->fixXmlConfig('validation_group')
->children()
->scalarNode('type')->defaultValue(LegacyFormHelper::getType('FOS\UserBundle\Form\Type\GroupFormType'))->end()
->scalarNode('type')->defaultValue(Type\GroupFormType::class)->end()
->scalarNode('name')->defaultValue('fos_user_group_form')->end()
->arrayNode('validation_groups')
->prototype('scalar')->end()
Expand Down
11 changes: 5 additions & 6 deletions Form/Type/ChangePasswordFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@

namespace FOS\UserBundle\Form\Type;

use FOS\UserBundle\Util\LegacyFormHelper;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
Expand Down Expand Up @@ -46,7 +47,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$constraintsOptions['groups'] = array(reset($options['validation_groups']));
}

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

$builder->add('plainPassword', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\RepeatedType'), array(
'type' => LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\PasswordType'),
$builder->add('plainPassword', RepeatedType::class, array(
'type' => PasswordType::class,
'options' => array('translation_domain' => 'FOSUserBundle'),
'first_options' => array('label' => 'form.new_password'),
'second_options' => array('label' => 'form.new_password_confirmation'),
Expand All @@ -73,8 +74,6 @@ public function configureOptions(OptionsResolver $resolver)
$resolver->setDefaults(array(
'data_class' => $this->class,
'csrf_token_id' => 'change_password',
// BC for SF < 2.8
'intention' => 'change_password',
));
}

Expand Down
2 changes: 0 additions & 2 deletions Form/Type/GroupFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ public function configureOptions(OptionsResolver $resolver)
$resolver->setDefaults(array(
'data_class' => $this->class,
'csrf_token_id' => 'group',
// BC for SF < 2.8
'intention' => 'group',
));
}

Expand Down
9 changes: 4 additions & 5 deletions Form/Type/ProfileFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@

namespace FOS\UserBundle\Form\Type;

use FOS\UserBundle\Util\LegacyFormHelper;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
Expand Down Expand Up @@ -48,7 +49,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$constraintsOptions['groups'] = array(reset($options['validation_groups']));
}

$builder->add('current_password', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\PasswordType'), array(
$builder->add('current_password', PasswordType::class, array(
'label' => 'form.current_password',
'translation_domain' => 'FOSUserBundle',
'mapped' => false,
Expand All @@ -67,8 +68,6 @@ public function configureOptions(OptionsResolver $resolver)
$resolver->setDefaults(array(
'data_class' => $this->class,
'csrf_token_id' => 'profile',
// BC for SF < 2.8
'intention' => 'profile',
));
}

Expand Down Expand Up @@ -99,7 +98,7 @@ protected function buildUserForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('username', null, array('label' => 'form.username', 'translation_domain' => 'FOSUserBundle'))
->add('email', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\EmailType'), array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle'))
->add('email', EmailType::class, array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle'))
;
}
}
12 changes: 6 additions & 6 deletions Form/Type/RegistrationFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@

namespace FOS\UserBundle\Form\Type;

use FOS\UserBundle\Util\LegacyFormHelper;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

Expand All @@ -37,10 +39,10 @@ public function __construct($class)
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('email', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\EmailType'), array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle'))
->add('email', EmailType::class, array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle'))
->add('username', null, array('label' => 'form.username', 'translation_domain' => 'FOSUserBundle'))
->add('plainPassword', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\RepeatedType'), array(
'type' => LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\PasswordType'),
->add('plainPassword', RepeatedType::class, array(
'type' => PasswordType::class,
'options' => array('translation_domain' => 'FOSUserBundle'),
'first_options' => array('label' => 'form.password'),
'second_options' => array('label' => 'form.password_confirmation'),
Expand All @@ -57,8 +59,6 @@ public function configureOptions(OptionsResolver $resolver)
$resolver->setDefaults(array(
'data_class' => $this->class,
'csrf_token_id' => 'registration',
// BC for SF < 2.8
'intention' => 'registration',
));
}

Expand Down
9 changes: 4 additions & 5 deletions Form/Type/ResettingFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@

namespace FOS\UserBundle\Form\Type;

use FOS\UserBundle\Util\LegacyFormHelper;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

Expand All @@ -36,8 +37,8 @@ public function __construct($class)
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('plainPassword', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\RepeatedType'), array(
'type' => LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\PasswordType'),
$builder->add('plainPassword', RepeatedType::class, array(
'type' => PasswordType::class,
'options' => array('translation_domain' => 'FOSUserBundle'),
'first_options' => array('label' => 'form.new_password'),
'second_options' => array('label' => 'form.new_password_confirmation'),
Expand All @@ -53,8 +54,6 @@ public function configureOptions(OptionsResolver $resolver)
$resolver->setDefaults(array(
'data_class' => $this->class,
'csrf_token_id' => 'resetting',
// BC for SF < 2.8
'intention' => 'resetting',
));
}

Expand Down
4 changes: 2 additions & 2 deletions Form/Type/UsernameFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
namespace FOS\UserBundle\Form\Type;

use FOS\UserBundle\Form\DataTransformer\UserToUsernameTransformer;
use FOS\UserBundle\Util\LegacyFormHelper;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;

/**
Expand Down Expand Up @@ -51,7 +51,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
*/
public function getParent()
{
return LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\TextType');
return TextType::class;
}

// BC for SF < 3.0
Expand Down
11 changes: 0 additions & 11 deletions Resources/doc/adding_invitation_registration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,11 @@ Override the default registration form with your own::
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('invitation', 'AppBundle\Form\InvitationFormType');

// Or for Symfony < 2.8
// $builder->add('invitation', 'app_invitation_type');
}

public function getParent()
{
return 'FOS\UserBundle\Form\Type\RegistrationFormType';

// Or for Symfony < 2.8
// return 'fos_user_registration';
}

public function getBlockPrefix()
Expand Down Expand Up @@ -183,9 +177,6 @@ Create the invitation field::
public function getParent()
{
return 'Symfony\Component\Form\Extension\Core\Type\TextType';

// Or for Symfony < 2.8
// return 'text';
}

public function getBlockPrefix()
Expand Down Expand Up @@ -327,7 +318,5 @@ Next overwrite the default ``RegistrationFormType`` with the one just created :
registration:
form:
type: AppBundle\Form\RegistrationFormType
# Or for Symfony < 2.8
# type: app_user_registration

You are done, go to your registration form to see the result.
4 changes: 0 additions & 4 deletions Resources/doc/command_line_tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ to enter one. An example of using this command is listed below.

.. code-block:: bash

$ php app/console fos:user:activate testuser
$ # OR if you are using Symfony >= 2.8 with the new directory structure
$ php bin/console fos:user:activate testuser

Deactivate a User
Expand All @@ -86,8 +84,6 @@ to enter one. Below is an example of using this command.

.. code-block:: bash

$ php app/console fos:user:deactivate testuser
$ # OR if you are using Symfony >= 2.8 with the new directory structure
$ php bin/console fos:user:deactivate testuser

Promote a User
Expand Down
10 changes: 5 additions & 5 deletions Resources/doc/configuration_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ All available configuration options are listed below with their default values.
sender_name: webmaster
profile:
form:
type: FOS\UserBundle\Form\Type\ProfileFormType # or 'fos_user_profile' on Symfony < 2.8
type: FOS\UserBundle\Form\Type\ProfileFormType
name: fos_user_profile_form
validation_groups: [Profile, Default]
change_password:
form:
type: FOS\UserBundle\Form\Type\ChangePasswordFormType # or 'fos_user_change_password' on Symfony < 2.8
type: FOS\UserBundle\Form\Type\ChangePasswordFormType
name: fos_user_change_password_form
validation_groups: [ChangePassword, Default]
registration:
Expand All @@ -35,7 +35,7 @@ All available configuration options are listed below with their default values.
enabled: false # change to true for required email confirmation
template: '@FOSUser/Registration/email.txt.twig'
form:
type: FOS\UserBundle\Form\Type\RegistrationFormType # or 'fos_user_registration' on Symfony < 2.8
type: FOS\UserBundle\Form\Type\RegistrationFormType
name: fos_user_registration_form
validation_groups: [Registration, Default]
resetting:
Expand All @@ -47,7 +47,7 @@ All available configuration options are listed below with their default values.
sender_name: ...
template: '@FOSUser/Resetting/email.txt.twig'
form:
type: FOS\UserBundle\Form\Type\ResettingFormType # or 'fos_user_resetting' on Symfony < 2.8
type: FOS\UserBundle\Form\Type\ResettingFormType
name: fos_user_resetting_form
validation_groups: [ResetPassword, Default]
service:
Expand All @@ -60,6 +60,6 @@ All available configuration options are listed below with their default values.
group_class: ~ # Required when using groups
group_manager: fos_user.group_manager.default
form:
type: FOS\UserBundle\Form\Type\GroupFormType # or 'fos_user_group' on Symfony < 2.8
type: FOS\UserBundle\Form\Type\GroupFormType
name: fos_user_group_form
validation_groups: [Registration, Default]
3 changes: 0 additions & 3 deletions Resources/doc/form_type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ instance::
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('recipient', 'FOS\UserBundle\Form\Type\UsernameFormType');

// if you are using Symfony < 2.8 you should use the old name instead
// $builder->add('recipient', 'fos_user_username');
}
}

Expand Down
4 changes: 1 addition & 3 deletions Resources/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ For a video tutorial, check out `FOSUserBundle FTW`_ by KnpUniversity.
Prerequisites
-------------

This version of the bundle requires Symfony 2.7+. If you are using an older
This version of the bundle requires Symfony 2.8+. If you are using an older
Symfony version, please use the 1.3.x releases of the bundle.

Translations
Expand Down Expand Up @@ -277,8 +277,6 @@ in your application:
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
# if you are using Symfony < 2.8, use the following config instead:
# csrf_provider: form.csrf_provider

logout: true
anonymous: true
Expand Down
5 changes: 0 additions & 5 deletions Resources/doc/overriding_forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ the form type hierarchy and then adds the custom ``name`` field.
public function getParent()
{
return 'FOS\UserBundle\Form\Type\RegistrationFormType';

// Or for Symfony < 2.8
// return 'fos_user_registration';
}

public function getBlockPrefix()
Expand Down Expand Up @@ -159,8 +156,6 @@ changing the registration form type in YAML.
registration:
form:
type: AppBundle\Form\RegistrationType
# if you are using Symfony < 2.8 you should use the type name instead
# type: app_user_registration

Note how the ``alias`` value used in your form type's service configuration tag
is used in the bundle configuration to tell the FOSUserBundle to use your custom
Expand Down
Loading