From d60fb449c83233a5743040d19e054036f8c3d118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C5=A1a=20Stamemkovi=C4=87?= Date: Thu, 14 Apr 2016 17:55:21 +0200 Subject: [PATCH] Symfony 3.0 upgrade fixes --- .../Form/Type/FileInfoType.php | 5 ++-- .../Controller/GridController.php | 5 ++-- .../Form/Type/Filter/DateRangeFilterType.php | 2 +- .../Type/Filter/DateTimeRangeFilterType.php | 2 +- .../Form/Type/Filter/FilterType.php | 2 +- .../Form/Type/Filter/NumberFilterType.php | 2 +- .../Form/Type/Filter/TextFilterType.php | 2 +- .../DataTransformer/EntityToIdTransformer.php | 2 +- .../FixArrayToStringListener.php | 2 +- .../Form/Type/EntityIdentifierType.php | 5 ++-- .../Form/Type/PageStateType.php | 8 ++++--- .../Form/Type/AclPermissionType.php | 5 ++-- .../Form/Type/AclPrivilegeIdentityType.php | 5 ++-- .../Form/Type/AclPrivilegeType.php | 2 +- .../Form/Type/ObjectLabelType.php | 5 ++-- .../Form/Type/PermissionCollectionType.php | 5 ++-- .../Form/Type/PrivilegeCollectionType.php | 5 ++-- .../UserBundle/Controller/ResetController.php | 5 ++-- .../UserBundle/Controller/UserController.php | 5 ++-- .../Form/EventListener/PatchSubscriber.php | 2 +- .../UserBundle/Form/Type/AclRoleType.php | 5 ++-- .../Form/Type/ChangePasswordType.php | 8 ++++--- .../Bundle/UserBundle/Form/Type/GroupType.php | 5 ++-- .../Bundle/UserBundle/Form/Type/ResetType.php | 5 ++-- .../CommentBundle/Form/Type/CommentType.php | 10 ++++---- .../Form/Type/DatagridFilterChoiceType.php | 5 ++-- .../Form/Type/DatagridViewType.php | 10 ++++---- .../Controller/CategoryTreeController.php | 4 ++-- .../Form/Type/AssociationType.php | 2 +- .../Form/Type/AssociationTypeType.php | 2 +- .../Form/Type/AsyncSelectType.php | 5 ++-- .../Form/Type/AttributeGroupType.php | 5 ++-- .../Form/Type/AttributeOptionCreateType.php | 8 ++++--- .../Form/Type/AttributeOptionType.php | 11 +++++---- .../Form/Type/AttributeOptionValueType.php | 7 +++--- .../AvailableLocalesType.php | 2 +- .../Type/AttributeProperty/OptionsType.php | 5 ++-- .../Type/AttributeProperty/ScopableType.php | 5 ++-- .../Form/Type/AttributeRequirementType.php | 8 ++++--- .../EnrichBundle/Form/Type/AttributeType.php | 11 +++++---- .../Form/Type/AvailableAttributesType.php | 2 +- .../EnrichBundle/Form/Type/CategoryType.php | 2 +- .../EnrichBundle/Form/Type/ChannelType.php | 8 ++++--- .../Form/Type/ConversionUnitsType.php | 2 +- .../EnrichBundle/Form/Type/FamilyType.php | 5 ++-- .../EnrichBundle/Form/Type/GroupType.php | 2 +- .../EnrichBundle/Form/Type/GroupTypeType.php | 2 +- .../Form/Type/LightEntityType.php | 5 ++-- .../Form/Type/LocalizedCollectionType.php | 5 ++-- .../Type/MassEditAction/AddToGroupsType.php | 2 +- .../MassEditAction/AddToVariantGroupType.php | 2 +- .../Type/MassEditAction/ChangeFamilyType.php | 2 +- .../Type/MassEditAction/ChangeStatusType.php | 2 +- .../Form/Type/MassEditAction/ClassifyType.php | 2 +- .../EditCommonAttributesType.php | 9 +++---- .../SetAttributeRequirementsType.php | 5 ++-- .../Form/Type/MassEditChooseActionType.php | 5 ++-- .../EnrichBundle/Form/Type/MetricType.php | 10 ++++---- .../Form/Type/ObjectIdentifierType.php | 5 ++-- .../EnrichBundle/Form/Type/PriceType.php | 7 +++--- .../Form/Type/ProductCreateType.php | 5 ++-- .../Form/Type/ProductEditType.php | 5 ++-- .../Form/Type/ProductTemplateType.php | 2 +- .../EnrichBundle/Form/Type/ProductType.php | 5 ++-- .../Form/Type/ProductValueType.php | 5 ++-- .../Form/Type/TranslatableFieldType.php | 2 +- .../EnrichBundle/Form/Type/UploadType.php | 2 +- .../FilterBundle/Form/Type/CategoryType.php | 7 +++--- .../FilterBundle/Form/Type/DateRangeType.php | 2 +- .../Form/Type/DateTimeRangeType.php | 2 +- .../Form/Type/Filter/MetricFilterType.php | 2 +- .../Form/Type/Filter/PriceFilterType.php | 5 ++-- .../Form/Type/JobConfigurationType.php | 5 ++-- .../Form/Type/JobInstanceType.php | 11 +++++---- .../Form/Type/StepConfigurationType.php | 2 +- .../Type/StepElementConfigurationType.php | 2 +- .../Form/Type/LocaleType.php | 5 ++-- .../UIBundle/Form/Type/AjaxEntityType.php | 5 ++-- .../Bundle/UIBundle/Form/Type/DateType.php | 2 +- .../Bundle/UIBundle/Form/Type/NumberType.php | 5 ++-- .../Bundle/UIBundle/Form/Type/SwitchType.php | 5 ++-- .../Form/Type/AclAccessLevelSelectorType.php | 5 ++-- .../Bundle/UserBundle/Form/Type/UserType.php | 24 +++++++++++-------- 83 files changed, 232 insertions(+), 166 deletions(-) diff --git a/src/Akeneo/Bundle/FileStorageBundle/Form/Type/FileInfoType.php b/src/Akeneo/Bundle/FileStorageBundle/Form/Type/FileInfoType.php index c26cc455590a..66b15915337c 100644 --- a/src/Akeneo/Bundle/FileStorageBundle/Form/Type/FileInfoType.php +++ b/src/Akeneo/Bundle/FileStorageBundle/Form/Type/FileInfoType.php @@ -3,6 +3,7 @@ namespace Akeneo\Bundle\FileStorageBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\FileType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -31,7 +32,7 @@ public function __construct($dataClass) */ public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('uploadedFile', 'file', ['required' => false]); + $builder->add('uploadedFile', FileType::class, ['required' => false]); } /** @@ -49,7 +50,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'akeneo_file_storage_file_info'; } diff --git a/src/Oro/Bundle/DataGridBundle/Controller/GridController.php b/src/Oro/Bundle/DataGridBundle/Controller/GridController.php index ec17435f195e..f5b9f81c4969 100644 --- a/src/Oro/Bundle/DataGridBundle/Controller/GridController.php +++ b/src/Oro/Bundle/DataGridBundle/Controller/GridController.php @@ -6,6 +6,7 @@ use Oro\Bundle\DataGridBundle\Extension\MassAction\MassActionParametersParser; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; class GridController extends Controller @@ -30,10 +31,8 @@ public function getAction($gridName) * @throws \LogicException * @return Response */ - public function massActionAction($gridName, $actionName) + public function massActionAction(Request $request, $gridName, $actionName) { - $request = $this->getRequest(); - /** @var MassActionParametersParser $massActionParametersParser */ $parametersParser = $this->get('oro_datagrid.mass_action.parameters_parser'); $parameters = $parametersParser->parse($request); diff --git a/src/Oro/Bundle/FilterBundle/Form/Type/Filter/DateRangeFilterType.php b/src/Oro/Bundle/FilterBundle/Form/Type/Filter/DateRangeFilterType.php index 1b3f8843cf16..9833bca74e4d 100644 --- a/src/Oro/Bundle/FilterBundle/Form/Type/Filter/DateRangeFilterType.php +++ b/src/Oro/Bundle/FilterBundle/Form/Type/Filter/DateRangeFilterType.php @@ -33,7 +33,7 @@ public function __construct(TranslatorInterface $translator) /** * {@inheritDoc} */ - public function getName() + public function getBlockPrefix() { return self::NAME; } diff --git a/src/Oro/Bundle/FilterBundle/Form/Type/Filter/DateTimeRangeFilterType.php b/src/Oro/Bundle/FilterBundle/Form/Type/Filter/DateTimeRangeFilterType.php index 3a0123e8d0b2..b903a494e77d 100644 --- a/src/Oro/Bundle/FilterBundle/Form/Type/Filter/DateTimeRangeFilterType.php +++ b/src/Oro/Bundle/FilterBundle/Form/Type/Filter/DateTimeRangeFilterType.php @@ -31,7 +31,7 @@ public function __construct(TranslatorInterface $translator) /** * {@inheritDoc} */ - public function getName() + public function getBlockPrefix() { return self::NAME; } diff --git a/src/Oro/Bundle/FilterBundle/Form/Type/Filter/FilterType.php b/src/Oro/Bundle/FilterBundle/Form/Type/Filter/FilterType.php index c68efbee6535..1077b2080d61 100644 --- a/src/Oro/Bundle/FilterBundle/Form/Type/Filter/FilterType.php +++ b/src/Oro/Bundle/FilterBundle/Form/Type/Filter/FilterType.php @@ -31,7 +31,7 @@ public function __construct(TranslatorInterface $translator) /** * {@inheritDoc} */ - public function getName() + public function getBlockPrefix() { return self::NAME; } diff --git a/src/Oro/Bundle/FilterBundle/Form/Type/Filter/NumberFilterType.php b/src/Oro/Bundle/FilterBundle/Form/Type/Filter/NumberFilterType.php index 9962c5813d75..28068e67f0e8 100644 --- a/src/Oro/Bundle/FilterBundle/Form/Type/Filter/NumberFilterType.php +++ b/src/Oro/Bundle/FilterBundle/Form/Type/Filter/NumberFilterType.php @@ -36,7 +36,7 @@ public function __construct(TranslatorInterface $translator) /** * {@inheritDoc} */ - public function getName() + public function getBlockPrefix() { return self::NAME; } diff --git a/src/Oro/Bundle/FilterBundle/Form/Type/Filter/TextFilterType.php b/src/Oro/Bundle/FilterBundle/Form/Type/Filter/TextFilterType.php index 6849a4ec676a..95f7e63455ea 100644 --- a/src/Oro/Bundle/FilterBundle/Form/Type/Filter/TextFilterType.php +++ b/src/Oro/Bundle/FilterBundle/Form/Type/Filter/TextFilterType.php @@ -31,7 +31,7 @@ public function __construct(TranslatorInterface $translator) /** * {@inheritDoc} */ - public function getName() + public function getBlockPrefix() { return self::NAME; } diff --git a/src/Oro/Bundle/FormBundle/Form/DataTransformer/EntityToIdTransformer.php b/src/Oro/Bundle/FormBundle/Form/DataTransformer/EntityToIdTransformer.php index fd4581719014..de030cefdc2d 100644 --- a/src/Oro/Bundle/FormBundle/Form/DataTransformer/EntityToIdTransformer.php +++ b/src/Oro/Bundle/FormBundle/Form/DataTransformer/EntityToIdTransformer.php @@ -56,7 +56,7 @@ public function __construct(EntityManager $em, $className, $property = null, $qu $property = $this->getIdPropertyPathFromEntityManager($em, $className); } $this->property = $property; - $this->propertyAccessor = PropertyAccess::getPropertyAccessor(); + $this->propertyAccessor = PropertyAccess::createPropertyAccessor(); $this->propertyPath = new PropertyPath($this->property); if (null !== $queryBuilderCallback && !is_callable($queryBuilderCallback)) { throw new UnexpectedTypeException($queryBuilderCallback, 'callable'); diff --git a/src/Oro/Bundle/FormBundle/Form/EventListener/FixArrayToStringListener.php b/src/Oro/Bundle/FormBundle/Form/EventListener/FixArrayToStringListener.php index a03ae057c9e4..442aeba871bf 100644 --- a/src/Oro/Bundle/FormBundle/Form/EventListener/FixArrayToStringListener.php +++ b/src/Oro/Bundle/FormBundle/Form/EventListener/FixArrayToStringListener.php @@ -28,6 +28,6 @@ public function preBind(FormEvent $event) public static function getSubscribedEvents() { - return [FormEvents::PRE_BIND => 'preBind']; + return [FormEvents::PRE_SUBMIT => 'preBind']; } } diff --git a/src/Oro/Bundle/FormBundle/Form/Type/EntityIdentifierType.php b/src/Oro/Bundle/FormBundle/Form/Type/EntityIdentifierType.php index 9416f164de38..94f70a2e6976 100644 --- a/src/Oro/Bundle/FormBundle/Form/Type/EntityIdentifierType.php +++ b/src/Oro/Bundle/FormBundle/Form/Type/EntityIdentifierType.php @@ -10,6 +10,7 @@ use Oro\Bundle\FormBundle\Form\EventListener\FixArrayToStringListener; use Oro\Bundle\FormBundle\Form\Exception\FormException; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -133,7 +134,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return self::NAME; } @@ -143,6 +144,6 @@ public function getName() */ public function getParent() { - return 'hidden'; + return HiddenType::class; } } diff --git a/src/Oro/Bundle/NavigationBundle/Form/Type/PageStateType.php b/src/Oro/Bundle/NavigationBundle/Form/Type/PageStateType.php index 5b755aef81c2..05a532be47d1 100644 --- a/src/Oro/Bundle/NavigationBundle/Form/Type/PageStateType.php +++ b/src/Oro/Bundle/NavigationBundle/Form/Type/PageStateType.php @@ -3,6 +3,8 @@ namespace Oro\Bundle\NavigationBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -16,14 +18,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'pageId', - 'text', + TextType::class, [ 'required' => true, ] ) ->add( 'data', - 'textarea', + TextareaType::class, [ 'required' => true, ] @@ -47,7 +49,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pagestate'; } diff --git a/src/Oro/Bundle/SecurityBundle/Form/Type/AclPermissionType.php b/src/Oro/Bundle/SecurityBundle/Form/Type/AclPermissionType.php index 562b07a72a2e..880f34bb4e8b 100644 --- a/src/Oro/Bundle/SecurityBundle/Form/Type/AclPermissionType.php +++ b/src/Oro/Bundle/SecurityBundle/Form/Type/AclPermissionType.php @@ -3,6 +3,7 @@ namespace Oro\Bundle\SecurityBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -22,7 +23,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ); $builder->add( 'name', - 'hidden', + HiddenType::class, [ 'required' => false, ] @@ -32,7 +33,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'oro_acl_permission'; } diff --git a/src/Oro/Bundle/SecurityBundle/Form/Type/AclPrivilegeIdentityType.php b/src/Oro/Bundle/SecurityBundle/Form/Type/AclPrivilegeIdentityType.php index de351d86d46e..dd8d2f2535e1 100644 --- a/src/Oro/Bundle/SecurityBundle/Form/Type/AclPrivilegeIdentityType.php +++ b/src/Oro/Bundle/SecurityBundle/Form/Type/AclPrivilegeIdentityType.php @@ -3,6 +3,7 @@ namespace Oro\Bundle\SecurityBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -15,7 +16,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add( 'id', - 'hidden', + HiddenType::class, [ 'required' => true, ] @@ -32,7 +33,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'oro_acl_privilege_identity'; } diff --git a/src/Oro/Bundle/SecurityBundle/Form/Type/AclPrivilegeType.php b/src/Oro/Bundle/SecurityBundle/Form/Type/AclPrivilegeType.php index cdb613f10c29..3bc60f06806d 100644 --- a/src/Oro/Bundle/SecurityBundle/Form/Type/AclPrivilegeType.php +++ b/src/Oro/Bundle/SecurityBundle/Form/Type/AclPrivilegeType.php @@ -64,7 +64,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'oro_acl_privilege'; } diff --git a/src/Oro/Bundle/SecurityBundle/Form/Type/ObjectLabelType.php b/src/Oro/Bundle/SecurityBundle/Form/Type/ObjectLabelType.php index 7cd75d8e4188..f77e0868098f 100644 --- a/src/Oro/Bundle/SecurityBundle/Form/Type/ObjectLabelType.php +++ b/src/Oro/Bundle/SecurityBundle/Form/Type/ObjectLabelType.php @@ -3,13 +3,14 @@ namespace Oro\Bundle\SecurityBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; class ObjectLabelType extends AbstractType { /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'oro_acl_label'; } @@ -19,6 +20,6 @@ public function getName() */ public function getParent() { - return 'hidden'; + return HiddenType::class; } } diff --git a/src/Oro/Bundle/SecurityBundle/Form/Type/PermissionCollectionType.php b/src/Oro/Bundle/SecurityBundle/Form/Type/PermissionCollectionType.php index 68add2f32a90..57b8aa51fe25 100644 --- a/src/Oro/Bundle/SecurityBundle/Form/Type/PermissionCollectionType.php +++ b/src/Oro/Bundle/SecurityBundle/Form/Type/PermissionCollectionType.php @@ -3,6 +3,7 @@ namespace Oro\Bundle\SecurityBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; @@ -23,7 +24,7 @@ public function buildView(FormView $view, FormInterface $form, array $options) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'oro_acl_permission_collection'; } @@ -33,6 +34,6 @@ public function getName() */ public function getParent() { - return 'collection'; + return CollectionType::class; } } diff --git a/src/Oro/Bundle/SecurityBundle/Form/Type/PrivilegeCollectionType.php b/src/Oro/Bundle/SecurityBundle/Form/Type/PrivilegeCollectionType.php index 557be1579ead..cc8e044b4428 100644 --- a/src/Oro/Bundle/SecurityBundle/Form/Type/PrivilegeCollectionType.php +++ b/src/Oro/Bundle/SecurityBundle/Form/Type/PrivilegeCollectionType.php @@ -3,6 +3,7 @@ namespace Oro\Bundle\SecurityBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; @@ -23,7 +24,7 @@ public function buildView(FormView $view, FormInterface $form, array $options) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'oro_acl_collection'; } @@ -33,6 +34,6 @@ public function getName() */ public function getParent() { - return 'collection'; + return CollectionType::class; } } diff --git a/src/Oro/Bundle/UserBundle/Controller/ResetController.php b/src/Oro/Bundle/UserBundle/Controller/ResetController.php index b1aac5943b1b..ee98fa769c72 100644 --- a/src/Oro/Bundle/UserBundle/Controller/ResetController.php +++ b/src/Oro/Bundle/UserBundle/Controller/ResetController.php @@ -5,6 +5,7 @@ use Pim\Bundle\UserBundle\Entity\UserInterface; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Component\HttpFoundation\Request; class ResetController extends Controller { @@ -21,9 +22,9 @@ public function requestAction() /** * Request reset user password */ - public function sendEmailAction() + public function sendEmailAction(Request $request) { - $username = $this->getRequest()->request->get('username'); + $username = $request->request->get('username'); $user = $this->get('oro_user.manager')->findUserByUsernameOrEmail($username); if (null === $user) { diff --git a/src/Oro/Bundle/UserBundle/Controller/UserController.php b/src/Oro/Bundle/UserBundle/Controller/UserController.php index 584033d63c72..6d66a72cfc0a 100644 --- a/src/Oro/Bundle/UserBundle/Controller/UserController.php +++ b/src/Oro/Bundle/UserBundle/Controller/UserController.php @@ -14,6 +14,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\EventDispatcher\GenericEvent; use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\User\UserInterface; @@ -56,7 +57,7 @@ public function updateProfileAction() * * @return JsonResponse|Response */ - public function apigenAction($id) + public function apigenAction(Request $request, $id) { $userRepository = $this->container->get('pim_user.repository.user'); $user = $userRepository->findOneBy(['id' => $id]); @@ -73,7 +74,7 @@ public function apigenAction($id) $em->persist($api); $em->flush(); - return $this->getRequest()->isXmlHttpRequest() + return $request->isXmlHttpRequest() ? new JsonResponse($api->getApiKey()) : $this->forward('OroUserBundle:User:view', ['user' => $user]); } diff --git a/src/Oro/Bundle/UserBundle/Form/EventListener/PatchSubscriber.php b/src/Oro/Bundle/UserBundle/Form/EventListener/PatchSubscriber.php index 5b45fc33eb99..9f16e0c33d3a 100644 --- a/src/Oro/Bundle/UserBundle/Form/EventListener/PatchSubscriber.php +++ b/src/Oro/Bundle/UserBundle/Form/EventListener/PatchSubscriber.php @@ -19,7 +19,7 @@ class PatchSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents() { - return [FormEvents::PRE_BIND => 'preBind']; + return [FormEvents::PRE_SUBMIT => 'preBind']; } public function preBind(FormEvent $event) diff --git a/src/Oro/Bundle/UserBundle/Form/Type/AclRoleType.php b/src/Oro/Bundle/UserBundle/Form/Type/AclRoleType.php index b71405f10b82..2f6fe13c8c18 100644 --- a/src/Oro/Bundle/UserBundle/Form/Type/AclRoleType.php +++ b/src/Oro/Bundle/UserBundle/Form/Type/AclRoleType.php @@ -5,6 +5,7 @@ use Oro\Bundle\SecurityBundle\Form\Type\AclPrivilegeType; use Oro\Bundle\SecurityBundle\Form\Type\PrivilegeCollectionType; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -30,7 +31,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add( 'label', - 'text', + TextType::class, [ 'required' => true, 'label' => 'Role' @@ -93,7 +94,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'oro_user_role_form'; } diff --git a/src/Oro/Bundle/UserBundle/Form/Type/ChangePasswordType.php b/src/Oro/Bundle/UserBundle/Form/Type/ChangePasswordType.php index 5211975bc65c..de2243e21005 100644 --- a/src/Oro/Bundle/UserBundle/Form/Type/ChangePasswordType.php +++ b/src/Oro/Bundle/UserBundle/Form/Type/ChangePasswordType.php @@ -4,6 +4,8 @@ use Oro\Bundle\UserBundle\Form\EventListener\ChangePasswordSubscriber; 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; @@ -32,7 +34,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder->add( 'currentPassword', - 'password', + PasswordType::class, [ 'required' => false, 'label' => 'Current password', @@ -44,7 +46,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'plainPassword', - 'repeated', + RepeatedType::class, [ 'required' => true, 'type' => 'password', @@ -65,7 +67,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'oro_change_password'; } diff --git a/src/Oro/Bundle/UserBundle/Form/Type/GroupType.php b/src/Oro/Bundle/UserBundle/Form/Type/GroupType.php index 6d316a7a88e0..209a34b39566 100644 --- a/src/Oro/Bundle/UserBundle/Form/Type/GroupType.php +++ b/src/Oro/Bundle/UserBundle/Form/Type/GroupType.php @@ -4,6 +4,7 @@ use Pim\Bundle\UserBundle\Entity\UserInterface; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -20,7 +21,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'name', - 'text', + TextType::class, [ 'required' => true, ] @@ -79,7 +80,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'oro_user_group'; } diff --git a/src/Oro/Bundle/UserBundle/Form/Type/ResetType.php b/src/Oro/Bundle/UserBundle/Form/Type/ResetType.php index e299d51796f1..b9ad72da1448 100644 --- a/src/Oro/Bundle/UserBundle/Form/Type/ResetType.php +++ b/src/Oro/Bundle/UserBundle/Form/Type/ResetType.php @@ -3,6 +3,7 @@ namespace Oro\Bundle\UserBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\RepeatedType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -26,7 +27,7 @@ public function __construct($class) */ public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('plainPassword', 'repeated', [ + $builder->add('plainPassword', RepeatedType::class, [ 'type' => 'password', 'required' => true, 'first_options' => ['label' => 'Password'], @@ -51,7 +52,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'oro_user_reset'; } diff --git a/src/Pim/Bundle/CommentBundle/Form/Type/CommentType.php b/src/Pim/Bundle/CommentBundle/Form/Type/CommentType.php index 169c6411f6f8..26011f6165a0 100644 --- a/src/Pim/Bundle/CommentBundle/Form/Type/CommentType.php +++ b/src/Pim/Bundle/CommentBundle/Form/Type/CommentType.php @@ -4,6 +4,8 @@ use Pim\Bundle\CommentBundle\Repository\CommentRepositoryInterface; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Translation\TranslatorInterface; @@ -50,11 +52,11 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'body', - 'textarea', + TextareaType::class, ['label' => false, 'attr' => ['placeholder' => $placeholder, 'class' => 'exclude']] ) - ->add('resourceName', 'hidden') - ->add('resourceId', 'hidden'); + ->add('resourceName', HiddenType::class) + ->add('resourceId', HiddenType::class); if (true === $options['is_reply']) { $builder->add('parent', 'pim_object_identifier', ['multiple' => false, 'repository' => $this->repository]); @@ -77,7 +79,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_comment_comment'; } diff --git a/src/Pim/Bundle/DataGridBundle/Form/Type/DatagridFilterChoiceType.php b/src/Pim/Bundle/DataGridBundle/Form/Type/DatagridFilterChoiceType.php index 98c2d65fc2f8..55d3e746cb1a 100644 --- a/src/Pim/Bundle/DataGridBundle/Form/Type/DatagridFilterChoiceType.php +++ b/src/Pim/Bundle/DataGridBundle/Form/Type/DatagridFilterChoiceType.php @@ -6,6 +6,7 @@ use Pim\Bundle\DataGridBundle\Datagrid\Configuration\ConfiguratorInterface; use Pim\Bundle\DataGridBundle\Datagrid\Configuration\Product\FiltersConfigurator; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\OptionsResolver\OptionsResolver; /** @@ -78,7 +79,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_datagrid_product_filter_choice'; } @@ -88,6 +89,6 @@ public function getName() */ public function getParent() { - return 'choice'; + return ChoiceType::class; } } diff --git a/src/Pim/Bundle/DataGridBundle/Form/Type/DatagridViewType.php b/src/Pim/Bundle/DataGridBundle/Form/Type/DatagridViewType.php index 37c62dbf28f2..8271035034cb 100644 --- a/src/Pim/Bundle/DataGridBundle/Form/Type/DatagridViewType.php +++ b/src/Pim/Bundle/DataGridBundle/Form/Type/DatagridViewType.php @@ -3,6 +3,8 @@ namespace Pim\Bundle\DataGridBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -32,9 +34,9 @@ public function __construct($dataClass) public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('label', 'text', ['required' => true]) - ->add('order', 'hidden') - ->add('filters', 'hidden'); + ->add('label', TextType::class, ['required' => true]) + ->add('order', HiddenType::class) + ->add('filters', HiddenType::class); } /** @@ -52,7 +54,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_datagrid_view'; } diff --git a/src/Pim/Bundle/EnrichBundle/Controller/CategoryTreeController.php b/src/Pim/Bundle/EnrichBundle/Controller/CategoryTreeController.php index 23fa7b8ac075..f9f1186f27fa 100644 --- a/src/Pim/Bundle/EnrichBundle/Controller/CategoryTreeController.php +++ b/src/Pim/Bundle/EnrichBundle/Controller/CategoryTreeController.php @@ -355,7 +355,7 @@ public function editAction(Request $request, $id) * * @return Response|RedirectResponse */ - public function removeAction($id) + public function removeAction(Request $request, $id) { if (false === $this->securityFacade->isGranted($this->buildAclName('category_remove'))) { throw new AccessDeniedException(); @@ -367,7 +367,7 @@ public function removeAction($id) $this->categoryRemover->remove($category, ['flush' => true]); - if ($this->getRequest()->isXmlHttpRequest()) { + if ($request->isXmlHttpRequest()) { return new Response('', 204); } else { return $this->redirectToRoute($this->buildRouteName('categorytree_index'), $params); diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/AssociationType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/AssociationType.php index 767546f54468..59299793b323 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/AssociationType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/AssociationType.php @@ -130,7 +130,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_association'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/AssociationTypeType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/AssociationTypeType.php index 31150f612f8a..1948b7935926 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/AssociationTypeType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/AssociationTypeType.php @@ -73,7 +73,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_associationtype'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/AsyncSelectType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/AsyncSelectType.php index 87869d1842e5..54fd97bf28e4 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/AsyncSelectType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/AsyncSelectType.php @@ -7,6 +7,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; @@ -44,7 +45,7 @@ public function __construct( /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_async_select'; } @@ -54,7 +55,7 @@ public function getName() */ public function getParent() { - return 'hidden'; + return HiddenType::class; } /** diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeGroupType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeGroupType.php index 00bd82d4b395..125944ea46c2 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeGroupType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeGroupType.php @@ -5,6 +5,7 @@ use Pim\Bundle\EnrichBundle\Form\Subscriber\DisableFieldSubscriber; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -48,7 +49,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'property_path' => 'translations' ] ) - ->add('sort_order', 'hidden') + ->add('sort_order', HiddenType::class) ->addEventSubscriber(new DisableFieldSubscriber('code')); foreach ($this->subscribers as $subscriber) { @@ -71,7 +72,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_attributegroup'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeOptionCreateType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeOptionCreateType.php index 55ee9a20ec5b..5067a6db66fa 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeOptionCreateType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeOptionCreateType.php @@ -3,6 +3,8 @@ namespace Pim\Bundle\EnrichBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -32,10 +34,10 @@ public function __construct($dataClass) public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('code', 'text', ['required' => true]) + ->add('code', TextType::class, ['required' => true]) ->add( 'optionValues', - 'collection', + CollectionType::class, [ 'type' => 'pim_enrich_attribute_option_value', 'allow_add' => true, @@ -60,7 +62,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_attribute_option_create'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeOptionType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeOptionType.php index 407c5133c867..67bcf8c910db 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeOptionType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeOptionType.php @@ -3,6 +3,9 @@ namespace Pim\Bundle\EnrichBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -45,7 +48,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) */ protected function addFieldId(FormBuilderInterface $builder) { - $builder->add('id', 'hidden'); + $builder->add('id', HiddenType::class); } /** @@ -55,7 +58,7 @@ protected function addFieldId(FormBuilderInterface $builder) */ protected function addFieldCode(FormBuilderInterface $builder) { - $builder->add('code', 'text', ['required' => true]); + $builder->add('code', TextType::class, ['required' => true]); } /** @@ -67,7 +70,7 @@ protected function addFieldOptionValues(FormBuilderInterface $builder) { $builder->add( 'optionValues', - 'collection', + CollectionType::class, [ 'type' => 'pim_enrich_attribute_option_value', 'allow_add' => true, @@ -93,7 +96,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_attribute_option'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeOptionValueType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeOptionValueType.php index a571b8fb9f1b..bca2edcc0d4d 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeOptionValueType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeOptionValueType.php @@ -3,6 +3,7 @@ namespace Pim\Bundle\EnrichBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -45,7 +46,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) */ protected function addFieldId(FormBuilderInterface $builder) { - $builder->add('id', 'hidden'); + $builder->add('id', HiddenType::class); } /** @@ -55,7 +56,7 @@ protected function addFieldId(FormBuilderInterface $builder) */ protected function addFieldLocale(FormBuilderInterface $builder) { - $builder->add('locale', 'hidden'); + $builder->add('locale', HiddenType::class); } /** @@ -83,7 +84,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_attribute_option_value'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeProperty/AvailableLocalesType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeProperty/AvailableLocalesType.php index e11f873f2453..943bfd8d0033 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeProperty/AvailableLocalesType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeProperty/AvailableLocalesType.php @@ -44,7 +44,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_available_locales'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeProperty/OptionsType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeProperty/OptionsType.php index 1c09e188fe16..0f9d39a44eb5 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeProperty/OptionsType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeProperty/OptionsType.php @@ -3,6 +3,7 @@ namespace Pim\Bundle\EnrichBundle\Form\Type\AttributeProperty; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\OptionsResolver\OptionsResolver; /** @@ -19,7 +20,7 @@ class OptionsType extends AbstractType */ public function getParent() { - return 'collection'; + return CollectionType::class; } /** @@ -40,7 +41,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_options'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeProperty/ScopableType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeProperty/ScopableType.php index e7ffd8d70fa5..41454021c653 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeProperty/ScopableType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeProperty/ScopableType.php @@ -3,6 +3,7 @@ namespace Pim\Bundle\EnrichBundle\Form\Type\AttributeProperty; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\OptionsResolver\OptionsResolver; /** @@ -19,7 +20,7 @@ class ScopableType extends AbstractType */ public function getParent() { - return 'choice'; + return ChoiceType::class; } /** @@ -43,7 +44,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_scopable'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeRequirementType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeRequirementType.php index a1205a4e27b3..b703fcb5488c 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeRequirementType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeRequirementType.php @@ -3,6 +3,8 @@ namespace Pim\Bundle\EnrichBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CheckboxType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; @@ -36,9 +38,9 @@ public function buildForm(FormBuilderInterface $builder, array $options) if ($options['keep_non_required']) { // Hidden value is used to store 1 or 0 and send the "uncheck" value // (which is impossible to do with a checkbox) - $builder->add('required', 'hidden'); + $builder->add('required', HiddenType::class); } else { - $builder->add('required', 'checkbox'); + $builder->add('required', CheckboxType::class); } } @@ -66,7 +68,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_attribute_requirement'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeType.php index 6f927785d94b..283515b6e53b 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeType.php @@ -5,6 +5,9 @@ use Pim\Bundle\EnrichBundle\Form\Subscriber\AddAttributeTypeRelatedFieldsSubscriber; use Pim\Component\Catalog\AttributeTypeRegistry; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -97,7 +100,7 @@ protected function addSubscriber(FormBuilderInterface $builder) */ protected function addFieldId(FormBuilderInterface $builder) { - $builder->add('id', 'hidden'); + $builder->add('id', HiddenType::class); } /** @@ -107,7 +110,7 @@ protected function addFieldId(FormBuilderInterface $builder) */ protected function addFieldCode(FormBuilderInterface $builder) { - $builder->add('code', 'text', ['required' => true]); + $builder->add('code', TextType::class, ['required' => true]); } /** @@ -117,7 +120,7 @@ protected function addFieldAttributeType(FormBuilderInterface $builder) { $builder->add( 'attributeType', - 'choice', + ChoiceType::class, [ 'choices' => $this->registry->getSortedAliases(), 'select2' => true, @@ -202,7 +205,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_attribute'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/AvailableAttributesType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/AvailableAttributesType.php index 28731c26f2d1..772565adcf41 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/AvailableAttributesType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/AvailableAttributesType.php @@ -110,7 +110,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_available_attributes'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/CategoryType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/CategoryType.php index bcecd2a2d07d..da3ecd43b168 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/CategoryType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/CategoryType.php @@ -90,7 +90,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_category'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/ChannelType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/ChannelType.php index 3ee4a535dba5..7b3d81591f31 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/ChannelType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/ChannelType.php @@ -11,6 +11,8 @@ use Pim\Component\Catalog\Repository\CurrencyRepositoryInterface; use Pim\Component\Catalog\Repository\LocaleRepositoryInterface; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; @@ -102,7 +104,7 @@ protected function addCodeField(FormBuilderInterface $builder) */ protected function addLabelField(FormBuilderInterface $builder) { - $builder->add('label', 'text', ['label' => 'Default label']); + $builder->add('label', TextType::class, ['label' => 'Default label']); return $this; } @@ -118,7 +120,7 @@ protected function addColorField(FormBuilderInterface $builder) { $builder->add( 'color', - 'choice', + ChoiceType::class, [ 'choices' => $this->provider->getColorChoices(), 'select2' => true, @@ -285,7 +287,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_channel'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/ConversionUnitsType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/ConversionUnitsType.php index ad92505175ac..5d20ced6eceb 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/ConversionUnitsType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/ConversionUnitsType.php @@ -69,7 +69,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_conversion_units'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/FamilyType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/FamilyType.php index fd1c452d6bb8..74be17c8f756 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/FamilyType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/FamilyType.php @@ -7,6 +7,7 @@ use Pim\Bundle\EnrichBundle\Form\Subscriber\DisableFamilyFieldsSubscriber; use Pim\Bundle\EnrichBundle\Form\Subscriber\DisableFieldSubscriber; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -115,7 +116,7 @@ protected function addLabelField(FormBuilderInterface $builder) */ protected function addAttributeRequirementsField(FormBuilderInterface $builder) { - $builder->add('attributeRequirements', 'collection', ['type' => 'pim_enrich_attribute_requirement']); + $builder->add('attributeRequirements', CollectionType::class, ['type' => 'pim_enrich_attribute_requirement']); return $this; } @@ -151,7 +152,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_family'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/GroupType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/GroupType.php index 800f2932d752..672497b90da0 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/GroupType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/GroupType.php @@ -81,7 +81,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_group'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/GroupTypeType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/GroupTypeType.php index 41e08a25bb61..753d2d56efaa 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/GroupTypeType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/GroupTypeType.php @@ -61,7 +61,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_grouptype'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/LightEntityType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/LightEntityType.php index c3d004efc807..cc2f3bc7cf46 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/LightEntityType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/LightEntityType.php @@ -7,6 +7,7 @@ use Pim\Bundle\EnrichBundle\Form\DataTransformer\EntityToIdentifierTransformer; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -26,13 +27,13 @@ class LightEntityType extends AbstractType */ public function getParent() { - return 'choice'; + return ChoiceType::class; } /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'light_entity'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/LocalizedCollectionType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/LocalizedCollectionType.php index efcfb284a393..b2cc6d3cfabd 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/LocalizedCollectionType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/LocalizedCollectionType.php @@ -5,6 +5,7 @@ use Pim\Bundle\EnrichBundle\Form\Subscriber\FilterLocaleSpecificValueSubscriber; use Pim\Bundle\EnrichBundle\Form\Subscriber\FilterLocaleValueSubscriber; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -53,13 +54,13 @@ public function configureOptions(OptionsResolver $resolver) */ public function getParent() { - return 'collection'; + return CollectionType::class; } /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_localized_collection'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/AddToGroupsType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/AddToGroupsType.php index ee4458e36ae2..dae28f0a5dc3 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/AddToGroupsType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/AddToGroupsType.php @@ -84,7 +84,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_mass_add_to_groups'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/AddToVariantGroupType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/AddToVariantGroupType.php index b2a5c5cadc29..e6bf4719754b 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/AddToVariantGroupType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/AddToVariantGroupType.php @@ -96,7 +96,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_mass_add_to_variant_group'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/ChangeFamilyType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/ChangeFamilyType.php index 1c82ade5b1be..f51d2a61251b 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/ChangeFamilyType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/ChangeFamilyType.php @@ -66,7 +66,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_mass_change_family'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/ChangeStatusType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/ChangeStatusType.php index 9390f2e9f14d..421d7bf2bbfb 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/ChangeStatusType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/ChangeStatusType.php @@ -49,7 +49,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_mass_change_status'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/ClassifyType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/ClassifyType.php index 8320bf2e0626..04a3e5612f52 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/ClassifyType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/ClassifyType.php @@ -97,7 +97,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_mass_classify'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/EditCommonAttributesType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/EditCommonAttributesType.php index 61dd9ccce7ae..274bdea528c2 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/EditCommonAttributesType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/EditCommonAttributesType.php @@ -3,6 +3,7 @@ namespace Pim\Bundle\EnrichBundle\Form\Type\MassEditAction; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -31,9 +32,9 @@ public function __construct($dataClass) */ public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('values', 'hidden'); - $builder->add('attribute_locale', 'hidden'); - $builder->add('attribute_channel', 'hidden'); + $builder->add('values', HiddenType::class); + $builder->add('attribute_locale', HiddenType::class); + $builder->add('attribute_channel', HiddenType::class); } /** @@ -47,7 +48,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_mass_edit_common_attributes'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/SetAttributeRequirementsType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/SetAttributeRequirementsType.php index b36451b55956..c7e178c67961 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/SetAttributeRequirementsType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditAction/SetAttributeRequirementsType.php @@ -3,6 +3,7 @@ namespace Pim\Bundle\EnrichBundle\Form\Type\MassEditAction; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -34,7 +35,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'attributeRequirements', - 'collection', + CollectionType::class, [ 'type' => 'pim_enrich_attribute_requirement', 'options' => [ @@ -60,7 +61,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_mass_set_attribute_requirements'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditChooseActionType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditChooseActionType.php index 375508721adf..4f8ac8a7372f 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditChooseActionType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/MassEditChooseActionType.php @@ -3,6 +3,7 @@ namespace Pim\Bundle\EnrichBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -23,7 +24,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'operationAlias', - 'choice', + ChoiceType::class, [ 'choices' => $options['operations'], 'expanded' => true, @@ -47,7 +48,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_mass_edit_choose_action'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/MetricType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/MetricType.php index 6cae6cb16f1d..a043df207c8c 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/MetricType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/MetricType.php @@ -3,6 +3,8 @@ namespace Pim\Bundle\EnrichBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -41,10 +43,10 @@ public function buildForm(FormBuilderInterface $builder, array $options) } $builder - ->add('id', 'hidden') + ->add('id', HiddenType::class) ->add('data', 'pim_number') - ->add('unit', 'choice', $unitOptions) - ->add('family', 'hidden', ['data' => $options['family']]); + ->add('unit', ChoiceType::class, $unitOptions) + ->add('family', HiddenType::class, ['data' => $options['family']]); } /** @@ -65,7 +67,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_metric'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/ObjectIdentifierType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/ObjectIdentifierType.php index 95e7685acd04..2d4496987689 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/ObjectIdentifierType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/ObjectIdentifierType.php @@ -6,6 +6,7 @@ use Pim\Bundle\EnrichBundle\Form\DataTransformer\EntityToIdentifierTransformer; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -25,13 +26,13 @@ class ObjectIdentifierType extends AbstractType */ public function getParent() { - return 'hidden'; + return HiddenType::class; } /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_object_identifier'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/PriceType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/PriceType.php index f159adb8f3fc..665b1df36cc1 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/PriceType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/PriceType.php @@ -3,6 +3,7 @@ namespace Pim\Bundle\EnrichBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -31,8 +32,8 @@ public function __construct($dataClass) */ public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('id', 'hidden'); - $builder->add('currency', 'hidden'); + $builder->add('id', HiddenType::class); + $builder->add('currency', HiddenType::class); $builder->add('data', 'pim_number'); } @@ -51,7 +52,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_price'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/ProductCreateType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/ProductCreateType.php index 4f1f33fa34ac..6e03c7ed4cc8 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/ProductCreateType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/ProductCreateType.php @@ -5,6 +5,7 @@ use Akeneo\Component\StorageUtils\Repository\IdentifiableObjectRepositoryInterface; use Pim\Bundle\EnrichBundle\Doctrine\ORM\Repository\FamilySearchableRepository; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\FormBuilderInterface; /** @@ -36,7 +37,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'values', - 'collection', + CollectionType::class, [ 'type' => 'pim_product_value', 'allow_add' => true, @@ -62,7 +63,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_product_create'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/ProductEditType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/ProductEditType.php index cd06a958b91d..b091c83a2d1d 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/ProductEditType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/ProductEditType.php @@ -8,6 +8,7 @@ use Pim\Component\Catalog\Repository\FamilyRepositoryInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; @@ -54,7 +55,7 @@ public function __construct( /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_product_edit'; } @@ -82,7 +83,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'associations', - 'collection', + CollectionType::class, [ 'type' => 'pim_enrich_association' ] diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/ProductTemplateType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/ProductTemplateType.php index a62edd2cfe6d..fc16eba062ca 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/ProductTemplateType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/ProductTemplateType.php @@ -110,7 +110,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_enrich_product_template'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/ProductType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/ProductType.php index f0e236224ca0..3b3c3350e740 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/ProductType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/ProductType.php @@ -3,6 +3,7 @@ namespace Pim\Bundle\EnrichBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -34,7 +35,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) */ public function addEntityFields(FormBuilderInterface $builder) { - $builder->add('id', 'hidden'); + $builder->add('id', HiddenType::class); } /** @@ -74,7 +75,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_product'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/ProductValueType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/ProductValueType.php index 4fc2ac067bab..62c6871df834 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/ProductValueType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/ProductValueType.php @@ -6,6 +6,7 @@ use Pim\Component\Catalog\Model\ProductValueInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; @@ -55,7 +56,7 @@ public function __construct( */ public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('id', 'hidden'); + $builder->add('id', HiddenType::class); $builder->addEventSubscriber($this->subscriber); } @@ -87,7 +88,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_product_value'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/TranslatableFieldType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/TranslatableFieldType.php index cf939b409a59..1c90354883d5 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/TranslatableFieldType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/TranslatableFieldType.php @@ -102,7 +102,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_translatable_field'; } diff --git a/src/Pim/Bundle/EnrichBundle/Form/Type/UploadType.php b/src/Pim/Bundle/EnrichBundle/Form/Type/UploadType.php index 9ac0adccd51c..b030824ce502 100644 --- a/src/Pim/Bundle/EnrichBundle/Form/Type/UploadType.php +++ b/src/Pim/Bundle/EnrichBundle/Form/Type/UploadType.php @@ -17,7 +17,7 @@ class UploadType extends AbstractType /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'upload'; } diff --git a/src/Pim/Bundle/FilterBundle/Form/Type/CategoryType.php b/src/Pim/Bundle/FilterBundle/Form/Type/CategoryType.php index ad6d8166660c..16546ded6b12 100644 --- a/src/Pim/Bundle/FilterBundle/Form/Type/CategoryType.php +++ b/src/Pim/Bundle/FilterBundle/Form/Type/CategoryType.php @@ -3,6 +3,7 @@ namespace Pim\Bundle\FilterBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\IntegerType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; @@ -22,7 +23,7 @@ class CategoryType extends AbstractType /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return self::NAME; } @@ -35,14 +36,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'categoryId', - 'integer', + IntegerType::class, [ 'required' => false, ] ) ->add( 'treeId', - 'integer', + IntegerType::class, [ 'required' => false, ] diff --git a/src/Pim/Bundle/FilterBundle/Form/Type/DateRangeType.php b/src/Pim/Bundle/FilterBundle/Form/Type/DateRangeType.php index 76644ffa0874..2085077d2daa 100644 --- a/src/Pim/Bundle/FilterBundle/Form/Type/DateRangeType.php +++ b/src/Pim/Bundle/FilterBundle/Form/Type/DateRangeType.php @@ -16,7 +16,7 @@ class DateRangeType extends AbstractType /** * {@inheritDoc} */ - public function getName() + public function getBlockPrefix() { return self::NAME; } diff --git a/src/Pim/Bundle/FilterBundle/Form/Type/DateTimeRangeType.php b/src/Pim/Bundle/FilterBundle/Form/Type/DateTimeRangeType.php index 788687e3b80b..241d385d4b2b 100644 --- a/src/Pim/Bundle/FilterBundle/Form/Type/DateTimeRangeType.php +++ b/src/Pim/Bundle/FilterBundle/Form/Type/DateTimeRangeType.php @@ -13,7 +13,7 @@ class DateTimeRangeType extends AbstractType /** * {@inheritDoc} */ - public function getName() + public function getBlockPrefix() { return self::NAME; } diff --git a/src/Pim/Bundle/FilterBundle/Form/Type/Filter/MetricFilterType.php b/src/Pim/Bundle/FilterBundle/Form/Type/Filter/MetricFilterType.php index 6d7be724fc48..9e57020c467c 100644 --- a/src/Pim/Bundle/FilterBundle/Form/Type/Filter/MetricFilterType.php +++ b/src/Pim/Bundle/FilterBundle/Form/Type/Filter/MetricFilterType.php @@ -22,7 +22,7 @@ class MetricFilterType extends AbstractType /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return self::NAME; } diff --git a/src/Pim/Bundle/FilterBundle/Form/Type/Filter/PriceFilterType.php b/src/Pim/Bundle/FilterBundle/Form/Type/Filter/PriceFilterType.php index 4d718c9afc40..86b5bffaa86b 100644 --- a/src/Pim/Bundle/FilterBundle/Form/Type/Filter/PriceFilterType.php +++ b/src/Pim/Bundle/FilterBundle/Form/Type/Filter/PriceFilterType.php @@ -5,6 +5,7 @@ use Oro\Bundle\FilterBundle\Form\Type\Filter\NumberFilterType; use Pim\Component\Catalog\Repository\CurrencyRepositoryInterface; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; @@ -38,7 +39,7 @@ public function __construct(CurrencyRepositoryInterface $currencyRepository) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return self::NAME; } @@ -58,7 +59,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) { parent::buildForm($builder, $options); - $builder->add('currency', 'choice', $this->createCurrencyOptions($options)); + $builder->add('currency', ChoiceType::class, $this->createCurrencyOptions($options)); } /** diff --git a/src/Pim/Bundle/ImportExportBundle/Form/Type/JobConfigurationType.php b/src/Pim/Bundle/ImportExportBundle/Form/Type/JobConfigurationType.php index d07750e9bc4f..4861796a6a7e 100644 --- a/src/Pim/Bundle/ImportExportBundle/Form/Type/JobConfigurationType.php +++ b/src/Pim/Bundle/ImportExportBundle/Form/Type/JobConfigurationType.php @@ -3,6 +3,7 @@ namespace Pim\Bundle\ImportExportBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -23,7 +24,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'steps', - 'collection', + CollectionType::class, [ 'type' => 'pim_import_export_step_configuration' ] @@ -45,7 +46,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_import_export_job_configuration'; } diff --git a/src/Pim/Bundle/ImportExportBundle/Form/Type/JobInstanceType.php b/src/Pim/Bundle/ImportExportBundle/Form/Type/JobInstanceType.php index 428222e5d2b0..0e2bee5d9614 100644 --- a/src/Pim/Bundle/ImportExportBundle/Form/Type/JobInstanceType.php +++ b/src/Pim/Bundle/ImportExportBundle/Form/Type/JobInstanceType.php @@ -8,6 +8,9 @@ use Pim\Bundle\ImportExportBundle\Form\Subscriber\RemoveDuplicateJobConfigurationSubscriber; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Translation\TranslatorInterface; @@ -73,7 +76,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) protected function addCodeField(FormBuilderInterface $builder) { $builder - ->add('code', 'text') + ->add('code', TextType::class) ->addEventSubscriber(new DisableFieldSubscriber('code')); return $this; @@ -105,7 +108,7 @@ protected function addConnectorField(FormBuilderInterface $builder) $builder ->add( 'connector', - 'hidden', + HiddenType::class, [ 'required' => true, 'by_reference' => false, @@ -137,7 +140,7 @@ protected function addAliasField(FormBuilderInterface $builder) $builder ->add( 'alias', - 'choice', + ChoiceType::class, [ 'choices' => $choices, 'required' => true, @@ -179,7 +182,7 @@ protected function addJobConfigurationField(FormBuilderInterface $builder) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_import_export_jobInstance'; } diff --git a/src/Pim/Bundle/ImportExportBundle/Form/Type/StepConfigurationType.php b/src/Pim/Bundle/ImportExportBundle/Form/Type/StepConfigurationType.php index e2b1dd550f81..5903f84001f4 100644 --- a/src/Pim/Bundle/ImportExportBundle/Form/Type/StepConfigurationType.php +++ b/src/Pim/Bundle/ImportExportBundle/Form/Type/StepConfigurationType.php @@ -61,7 +61,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_import_export_step_configuration'; } diff --git a/src/Pim/Bundle/ImportExportBundle/Form/Type/StepElementConfigurationType.php b/src/Pim/Bundle/ImportExportBundle/Form/Type/StepElementConfigurationType.php index 3221679b80b4..fcfde523d7e4 100644 --- a/src/Pim/Bundle/ImportExportBundle/Form/Type/StepElementConfigurationType.php +++ b/src/Pim/Bundle/ImportExportBundle/Form/Type/StepElementConfigurationType.php @@ -72,7 +72,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_import_export_step_element_configuration'; } diff --git a/src/Pim/Bundle/LocalizationBundle/Form/Type/LocaleType.php b/src/Pim/Bundle/LocalizationBundle/Form/Type/LocaleType.php index b15a064762bc..9c55762d422e 100644 --- a/src/Pim/Bundle/LocalizationBundle/Form/Type/LocaleType.php +++ b/src/Pim/Bundle/LocalizationBundle/Form/Type/LocaleType.php @@ -4,6 +4,7 @@ use Akeneo\Component\Localization\Provider\LocaleProviderInterface; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\LocaleType; use Symfony\Component\OptionsResolver\OptionsResolver; class LocaleType extends AbstractType @@ -33,13 +34,13 @@ public function configureOptions(OptionsResolver $resolver) */ public function getParent() { - return 'locale'; + return LocaleType::class; } /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_locale'; } diff --git a/src/Pim/Bundle/UIBundle/Form/Type/AjaxEntityType.php b/src/Pim/Bundle/UIBundle/Form/Type/AjaxEntityType.php index f9d37b91bd0b..0c47f83ab425 100644 --- a/src/Pim/Bundle/UIBundle/Form/Type/AjaxEntityType.php +++ b/src/Pim/Bundle/UIBundle/Form/Type/AjaxEntityType.php @@ -6,6 +6,7 @@ use Pim\Bundle\UserBundle\Context\UserContext; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; @@ -65,7 +66,7 @@ public function __construct( /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_ajax_entity'; } @@ -75,7 +76,7 @@ public function getName() */ public function getParent() { - return 'hidden'; + return HiddenType::class; } /** diff --git a/src/Pim/Bundle/UIBundle/Form/Type/DateType.php b/src/Pim/Bundle/UIBundle/Form/Type/DateType.php index db2fc29cc537..e7db21f3ecf2 100644 --- a/src/Pim/Bundle/UIBundle/Form/Type/DateType.php +++ b/src/Pim/Bundle/UIBundle/Form/Type/DateType.php @@ -95,7 +95,7 @@ public function getParent() /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_date'; } diff --git a/src/Pim/Bundle/UIBundle/Form/Type/NumberType.php b/src/Pim/Bundle/UIBundle/Form/Type/NumberType.php index 763e01c84083..7176756949a1 100644 --- a/src/Pim/Bundle/UIBundle/Form/Type/NumberType.php +++ b/src/Pim/Bundle/UIBundle/Form/Type/NumberType.php @@ -9,6 +9,7 @@ use Pim\Bundle\EnrichBundle\Resolver\LocaleResolver; use Pim\Bundle\LocalizationBundle\Form\DataTransformer\NumberLocalizerTransformer; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -85,7 +86,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_number'; } @@ -95,6 +96,6 @@ public function getName() */ public function getParent() { - return 'text'; + return TextType::class; } } diff --git a/src/Pim/Bundle/UIBundle/Form/Type/SwitchType.php b/src/Pim/Bundle/UIBundle/Form/Type/SwitchType.php index a1561d7ab8bc..a85e51e77751 100644 --- a/src/Pim/Bundle/UIBundle/Form/Type/SwitchType.php +++ b/src/Pim/Bundle/UIBundle/Form/Type/SwitchType.php @@ -4,6 +4,7 @@ use Pim\Bundle\UIBundle\Form\Transformer\BooleanToStringTransformer; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -47,13 +48,13 @@ public function configureOptions(OptionsResolver $resolver) */ public function getParent() { - return 'checkbox'; + return CheckboxType::class; } /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'switch'; } diff --git a/src/Pim/Bundle/UserBundle/Form/Type/AclAccessLevelSelectorType.php b/src/Pim/Bundle/UserBundle/Form/Type/AclAccessLevelSelectorType.php index b58a72c61eef..d802cbb9339a 100644 --- a/src/Pim/Bundle/UserBundle/Form/Type/AclAccessLevelSelectorType.php +++ b/src/Pim/Bundle/UserBundle/Form/Type/AclAccessLevelSelectorType.php @@ -5,6 +5,7 @@ use Oro\Bundle\SecurityBundle\Acl\AccessLevel; use Pim\Bundle\UserBundle\Form\Transformer\AccessLevelToBooleanTransformer; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -33,13 +34,13 @@ public function buildForm(FormBuilderInterface $builder, array $options) */ public function getParent() { - return 'checkbox'; + return CheckboxType::class; } /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_acl_access_level_selector'; } diff --git a/src/Pim/Bundle/UserBundle/Form/Type/UserType.php b/src/Pim/Bundle/UserBundle/Form/Type/UserType.php index a8d8f9f71fc0..5c1971874847 100644 --- a/src/Pim/Bundle/UserBundle/Form/Type/UserType.php +++ b/src/Pim/Bundle/UserBundle/Form/Type/UserType.php @@ -9,6 +9,10 @@ use Pim\Bundle\UserBundle\Form\Subscriber\UserPreferencesSubscriber; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\EmailType; +use Symfony\Component\Form\Extension\Core\Type\FileType; +use Symfony\Component\Form\Extension\Core\Type\RepeatedType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; @@ -119,7 +123,7 @@ public function addEntityFields(FormBuilderInterface $builder) ) ->add( 'plainPassword', - 'repeated', + RepeatedType::class, [ 'type' => 'password', 'required' => true, @@ -171,7 +175,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getName() + public function getBlockPrefix() { return 'pim_user_user'; } @@ -186,14 +190,14 @@ protected function setDefaultUserFields(FormBuilderInterface $builder) $builder ->add( 'username', - 'text', + TextType::class, [ 'required' => true, ] ) ->add( 'email', - 'email', + EmailType::class, [ 'label' => 'E-mail', 'required' => true, @@ -201,7 +205,7 @@ protected function setDefaultUserFields(FormBuilderInterface $builder) ) ->add( 'namePrefix', - 'text', + TextType::class, [ 'label' => 'Name prefix', 'required' => false, @@ -209,7 +213,7 @@ protected function setDefaultUserFields(FormBuilderInterface $builder) ) ->add( 'firstName', - 'text', + TextType::class, [ 'label' => 'First name', 'required' => true, @@ -217,7 +221,7 @@ protected function setDefaultUserFields(FormBuilderInterface $builder) ) ->add( 'middleName', - 'text', + TextType::class, [ 'label' => 'Middle name', 'required' => false, @@ -225,7 +229,7 @@ protected function setDefaultUserFields(FormBuilderInterface $builder) ) ->add( 'lastName', - 'text', + TextType::class, [ 'label' => 'Last name', 'required' => true, @@ -233,7 +237,7 @@ protected function setDefaultUserFields(FormBuilderInterface $builder) ) ->add( 'nameSuffix', - 'text', + TextType::class, [ 'label' => 'Name suffix', 'required' => false, @@ -249,7 +253,7 @@ protected function setDefaultUserFields(FormBuilderInterface $builder) ) ->add( 'imageFile', - 'file', + FileType::class, [ 'label' => 'Avatar', 'required' => false,