Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symfony 3.0 upgrade #3571

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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]);
}

/**
Expand All @@ -49,7 +50,7 @@ public function configureOptions(OptionsResolver $resolver)
/**
* {@inheritdoc}
*/
public function getName()
public function getBlockPrefix()
{
return 'akeneo_file_storage_file_info';
}
Expand Down
5 changes: 2 additions & 3 deletions src/Oro/Bundle/DataGridBundle/Controller/GridController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(TranslatorInterface $translator)
/**
* {@inheritDoc}
*/
public function getName()
public function getBlockPrefix()
{
return self::NAME;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(TranslatorInterface $translator)
/**
* {@inheritDoc}
*/
public function getName()
public function getBlockPrefix()
{
return self::NAME;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(TranslatorInterface $translator)
/**
* {@inheritDoc}
*/
public function getName()
public function getBlockPrefix()
{
return self::NAME;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(TranslatorInterface $translator)
/**
* {@inheritDoc}
*/
public function getName()
public function getBlockPrefix()
{
return self::NAME;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(TranslatorInterface $translator)
/**
* {@inheritDoc}
*/
public function getName()
public function getBlockPrefix()
{
return self::NAME;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public function preBind(FormEvent $event)

public static function getSubscribedEvents()
{
return [FormEvents::PRE_BIND => 'preBind'];
return [FormEvents::PRE_SUBMIT => 'preBind'];
}
}
5 changes: 3 additions & 2 deletions src/Oro/Bundle/FormBundle/Form/Type/EntityIdentifierType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -133,7 +134,7 @@ public function configureOptions(OptionsResolver $resolver)
/**
* {@inheritdoc}
*/
public function getName()
public function getBlockPrefix()
{
return self::NAME;
}
Expand All @@ -143,6 +144,6 @@ public function getName()
*/
public function getParent()
{
return 'hidden';
return HiddenType::class;
}
}
8 changes: 5 additions & 3 deletions src/Oro/Bundle/NavigationBundle/Form/Type/PageStateType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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,
]
Expand All @@ -47,7 +49,7 @@ public function configureOptions(OptionsResolver $resolver)
/**
* {@inheritdoc}
*/
public function getName()
public function getBlockPrefix()
{
return 'pagestate';
}
Expand Down
5 changes: 3 additions & 2 deletions src/Oro/Bundle/SecurityBundle/Form/Type/AclPermissionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -22,7 +23,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
);
$builder->add(
'name',
'hidden',
HiddenType::class,
[
'required' => false,
]
Expand All @@ -32,7 +33,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
/**
* {@inheritdoc}
*/
public function getName()
public function getBlockPrefix()
{
return 'oro_acl_permission';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -15,7 +16,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add(
'id',
'hidden',
HiddenType::class,
[
'required' => true,
]
Expand All @@ -32,7 +33,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
/**
* {@inheritdoc}
*/
public function getName()
public function getBlockPrefix()
{
return 'oro_acl_privilege_identity';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function configureOptions(OptionsResolver $resolver)
/**
* {@inheritdoc}
*/
public function getName()
public function getBlockPrefix()
{
return 'oro_acl_privilege';
}
Expand Down
5 changes: 3 additions & 2 deletions src/Oro/Bundle/SecurityBundle/Form/Type/ObjectLabelType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand All @@ -19,6 +20,6 @@ public function getName()
*/
public function getParent()
{
return 'hidden';
return HiddenType::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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';
}
Expand All @@ -33,6 +34,6 @@ public function getName()
*/
public function getParent()
{
return 'collection';
return CollectionType::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -23,7 +24,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
/**
* {@inheritdoc}
*/
public function getName()
public function getBlockPrefix()
{
return 'oro_acl_collection';
}
Expand All @@ -33,6 +34,6 @@ public function getName()
*/
public function getParent()
{
return 'collection';
return CollectionType::class;
}
}
5 changes: 3 additions & 2 deletions src/Oro/Bundle/UserBundle/Controller/ResetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions src/Oro/Bundle/UserBundle/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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]);
Expand All @@ -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]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions src/Oro/Bundle/UserBundle/Form/Type/AclRoleType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -30,7 +31,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add(
'label',
'text',
TextType::class,
[
'required' => true,
'label' => 'Role'
Expand Down Expand Up @@ -93,7 +94,7 @@ public function configureOptions(OptionsResolver $resolver)
/**
* {@inheritdoc}
*/
public function getName()
public function getBlockPrefix()
{
return 'oro_user_role_form';
}
Expand Down
Loading