From 5262236711a8a3b05575db74ec978628768e136e Mon Sep 17 00:00:00 2001 From: pas Date: Thu, 24 Dec 2020 15:12:00 +0700 Subject: [PATCH] some codestyle fix --- Form/DataTransformer/EntityToPropertyTransformer.php | 3 +-- Form/Type/Select2EntityType.php | 12 ++++++------ Service/AutocompleteService.php | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Form/DataTransformer/EntityToPropertyTransformer.php b/Form/DataTransformer/EntityToPropertyTransformer.php index 72a30a9..c4bb872 100644 --- a/Form/DataTransformer/EntityToPropertyTransformer.php +++ b/Form/DataTransformer/EntityToPropertyTransformer.php @@ -109,8 +109,7 @@ public function reverseTransform($value) ->setParameter('id', $value) ->getQuery() ->getSingleResult(); - } - catch (\Doctrine\ORM\UnexpectedResultException $ex) { + } catch (\Doctrine\ORM\UnexpectedResultException $ex) { // this will happen if the form submits invalid data throw new TransformationFailedException(sprintf('The choice "%s" does not exist or is not unique', $value)); } diff --git a/Form/Type/Select2EntityType.php b/Form/Type/Select2EntityType.php index ad7f8d4..dd7462c 100644 --- a/Form/Type/Select2EntityType.php +++ b/Form/Type/Select2EntityType.php @@ -61,8 +61,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) throw new \Exception('The entity manager \'em\' must be an ObjectManager instance'); } $this->em = $em; - } - else { + } else { $manager = $this->registry->getManagerForClass($options['class']); if ($manager instanceof ObjectManager) { $this->em = $manager; @@ -115,7 +114,7 @@ public function finishView(FormView $view, FormInterface $form, array $options) $reqParams = []; foreach ($options['req_params'] as $key => $reqParam) { - $reqParams[$key] = $accessor->getValue($view, $reqParam . '.vars[full_name]'); + $reqParams[$key] = $accessor->getValue($view, $reqParam . '.vars[full_name]'); } $view->vars['attr']['data-req_params'] = json_encode($reqParams); @@ -131,7 +130,7 @@ public function finishView(FormView $view, FormInterface $form, array $options) $view->vars['full_name'] .= '[]'; } - $view->vars['class_type'] = $options['class_type']; + $view->vars['class_type'] = $options['class_type']; } /** @@ -139,7 +138,8 @@ public function finishView(FormView $view, FormInterface $form, array $options) */ public function configureOptions(OptionsResolver $resolver) { - $resolver->setDefaults([ + $resolver->setDefaults( + [ 'object_manager' => null, 'class' => null, 'data_class' => null, @@ -163,7 +163,7 @@ public function configureOptions(OptionsResolver $resolver) 'text_property' => null, 'placeholder' => false, 'language' => $this->config['language'], - 'theme' => $this->config['theme'], + 'theme' => $this->config['theme'], 'required' => false, 'cache' => $this->config['cache'], 'cache_timeout' => $this->config['cache_timeout'], diff --git a/Service/AutocompleteService.php b/Service/AutocompleteService.php index c4ba50a..fc47021 100644 --- a/Service/AutocompleteService.php +++ b/Service/AutocompleteService.php @@ -29,7 +29,7 @@ public function __construct(FormFactoryInterface $formFactory, ManagerRegistry $ { $this->formFactory = $formFactory; $this->doctrine = $doctrine; - } + } /** * @param Request $request