@@ -157,6 +157,9 @@ |
||
| 157 | 157 | ->getRepository('LoginCidadaoCoreBundle:InvalidateSessionRequest'); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | + /** |
|
| 161 | + * @param string $name |
|
| 162 | + */ |
|
| 160 | 163 | private function redirectRoute($name, $parameters = array()) |
| 161 | 164 | { |
| 162 | 165 | $url = $this->router->generate($name, $parameters); |
@@ -58,6 +58,7 @@ |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | + * @param NotificationInterface $notification |
|
| 61 | 62 | * @return PersonNotificationOption |
| 62 | 63 | */ |
| 63 | 64 | private function getSettings($notification) |
@@ -8,7 +8,6 @@ |
||
| 8 | 8 | use Vich\UploaderBundle\Templating\Helper\UploaderHelper; |
| 9 | 9 | use Symfony\Component\HttpKernel\Kernel; |
| 10 | 10 | use Symfony\Component\HttpFoundation\Request; |
| 11 | -use LoginCidadao\OAuthBundle\Model\AccessTokenManager; |
|
| 12 | 11 | use LoginCidadao\CoreBundle\Model\PersonInterface; |
| 13 | 12 | |
| 14 | 13 | class PersonSerializeEventListenner implements EventSubscriberInterface |
@@ -17,12 +17,9 @@ |
||
| 17 | 17 | use FOS\UserBundle\Mailer\MailerInterface; |
| 18 | 18 | use Doctrine\ORM\EntityManager; |
| 19 | 19 | use LoginCidadao\CoreBundle\Entity\City; |
| 20 | -use Assetic\Exception\Exception; |
|
| 21 | 20 | use LoginCidadao\CoreBundle\Exception\LcValidationException; |
| 22 | -use LoginCidadao\NotificationBundle\Entity\Notification; |
|
| 23 | 21 | use LoginCidadao\CoreBundle\Entity\Person; |
| 24 | 22 | use LoginCidadao\CoreBundle\Entity\State; |
| 25 | -use LoginCidadao\CoreBundle\DynamicFormEvents; |
|
| 26 | 23 | use LoginCidadao\CoreBundle\Model\DynamicFormData; |
| 27 | 24 | use LoginCidadao\CoreBundle\Model\SelectData; |
| 28 | 25 | use LoginCidadao\CoreBundle\Model\PersonInterface; |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $this->userManager = $var; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - private function checkEmailChanged(Person &$user) |
|
| 181 | + private function checkEmailChanged(Person & $user) |
|
| 182 | 182 | { |
| 183 | 183 | if ($user->getEmail() !== $this->email) { |
| 184 | 184 | if (is_null($user->getConfirmationToken())) { |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - private function checkCPFChanged(Person &$user) |
|
| 197 | + private function checkCPFChanged(Person & $user) |
|
| 198 | 198 | { |
| 199 | 199 | if ($user->getCpf() !== $this->cpf) { |
| 200 | 200 | if ($user->getCpf()) { |
@@ -10,8 +10,6 @@ |
||
| 10 | 10 | use Symfony\Component\Form\FormEvents; |
| 11 | 11 | use Symfony\Component\Form\FormInterface; |
| 12 | 12 | use Symfony\Component\OptionsResolver\OptionsResolver; |
| 13 | -use Doctrine\ORM\EntityManager; |
|
| 14 | -use Doctrine\ORM\EntityRepository; |
|
| 15 | 13 | use LoginCidadao\CoreBundle\Entity\State; |
| 16 | 14 | use LoginCidadao\CoreBundle\Model\SelectData; |
| 17 | 15 | use LoginCidadao\CoreBundle\Model\Manager\CityManager; |
@@ -218,7 +218,7 @@ |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | public function finishView(FormView $view, FormInterface $form, |
| 221 | - array $options) |
|
| 221 | + array $options) |
|
| 222 | 222 | { |
| 223 | 223 | if ($view->children['country']->vars['choice_translation_domain'] === false) { |
| 224 | 224 | return; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $cityManager = $this->cityManager; |
| 75 | 75 | $level = $options['level']; |
| 76 | 76 | |
| 77 | - $refreshState = function (FormInterface $form, $countryId = null) use ($options, $stateManager, $level, $preferredChoiceCallback) { |
|
| 77 | + $refreshState = function(FormInterface $form, $countryId = null) use ($options, $stateManager, $level, $preferredChoiceCallback) { |
|
| 78 | 78 | if ($level === 'country') { |
| 79 | 79 | return; |
| 80 | 80 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | )); |
| 116 | 116 | }; |
| 117 | 117 | |
| 118 | - $refreshCity = function (FormInterface $form, $stateId = null) use ($options, $cityManager, $level) { |
|
| 118 | + $refreshCity = function(FormInterface $form, $stateId = null) use ($options, $cityManager, $level) { |
|
| 119 | 119 | if ($level === 'country' || $level === 'state') { |
| 120 | 120 | return; |
| 121 | 121 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | }; |
| 157 | 157 | |
| 158 | 158 | $builder->addEventListener(FormEvents::PRE_SET_DATA, |
| 159 | - function (FormEvent $event) use ($refreshState, $refreshCity, $level) { |
|
| 159 | + function(FormEvent $event) use ($refreshState, $refreshCity, $level) { |
|
| 160 | 160 | $form = $event->getForm(); |
| 161 | 161 | $data = $event->getData(); |
| 162 | 162 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | }); |
| 180 | 180 | |
| 181 | 181 | $builder->addEventListener(FormEvents::PRE_SUBMIT, |
| 182 | - function (FormEvent $event) use ($refreshState, $refreshCity, $level) { |
|
| 182 | + function(FormEvent $event) use ($refreshState, $refreshCity, $level) { |
|
| 183 | 183 | $form = $event->getForm(); |
| 184 | 184 | $data = $event->getData(); |
| 185 | 185 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | } |
| 226 | 226 | $collator = new \Collator($this->translator->getLocale()); |
| 227 | 227 | $translator = $this->translator; |
| 228 | - $sortFunction = function ($a, $b) use ($collator, $translator) { |
|
| 228 | + $sortFunction = function($a, $b) use ($collator, $translator) { |
|
| 229 | 229 | return $collator->compare($translator->trans($a->label), |
| 230 | 230 | $translator->trans($b->label)); |
| 231 | 231 | }; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | private function getPreferredChoiceCallback() |
| 242 | 242 | { |
| 243 | - return function ($choice, $key) { |
|
| 243 | + return function($choice, $key) { |
|
| 244 | 244 | return $choice->getPreference() > 0; |
| 245 | 245 | }; |
| 246 | 246 | } |
@@ -11,12 +11,6 @@ |
||
| 11 | 11 | namespace LoginCidadao\CoreBundle\Form\Type; |
| 12 | 12 | |
| 13 | 13 | use Symfony\Component\Form\FormBuilderInterface; |
| 14 | -use Doctrine\ORM\EntityRepository; |
|
| 15 | -use LoginCidadao\CoreBundle\Entity\Country; |
|
| 16 | -use LoginCidadao\CoreBundle\Entity\State; |
|
| 17 | -use LoginCidadao\CoreBundle\Entity\City; |
|
| 18 | -use Symfony\Component\Form\FormEvent; |
|
| 19 | -use Symfony\Component\Form\FormEvents; |
|
| 20 | 14 | use Doctrine\ORM\EntityManager; |
| 21 | 15 | use Symfony\Component\Form\AbstractType; |
| 22 | 16 | |
@@ -5,9 +5,6 @@ |
||
| 5 | 5 | use Doctrine\ORM\EntityRepository; |
| 6 | 6 | use LoginCidadao\CoreBundle\Entity\Country; |
| 7 | 7 | use LoginCidadao\CoreBundle\Entity\State; |
| 8 | -use LoginCidadao\CoreBundle\Entity\City; |
|
| 9 | -use Symfony\Component\Form\FormEvent; |
|
| 10 | -use Symfony\Component\Form\FormEvents; |
|
| 11 | 8 | use Doctrine\ORM\EntityManager; |
| 12 | 9 | use Symfony\Component\Form\AbstractType; |
| 13 | 10 | |
@@ -27,14 +27,14 @@ |
||
| 27 | 27 | $builder->add('id', 'hidden', array( |
| 28 | 28 | 'required' => false |
| 29 | 29 | )); |
| 30 | - $builder->add('state', 'entity',array( |
|
| 30 | + $builder->add('state', 'entity', array( |
|
| 31 | 31 | 'required' => true, |
| 32 | 32 | 'class' => 'LoginCidadaoCoreBundle:State', |
| 33 | 33 | 'choice_label' => 'name', |
| 34 | 34 | 'query_builder' => function(EntityRepository $er) { |
| 35 | 35 | $country = $er->createQueryBuilder('h')->getEntityManager()->getRepository('LoginCidadaoCoreBundle:Country')->findOneBy(array('iso2' => 'BR')); |
| 36 | 36 | return $er->createQueryBuilder('u') |
| 37 | - ->where('u.reviewed = ' . Country::REVIEWED_OK) |
|
| 37 | + ->where('u.reviewed = '.Country::REVIEWED_OK) |
|
| 38 | 38 | ->andWhere('u.country = :country') |
| 39 | 39 | ->setParameter('country', $country) |
| 40 | 40 | ->orderBy('u.name', 'ASC'); |
@@ -6,14 +6,11 @@ |
||
| 6 | 6 | use Symfony\Component\Form\AbstractType; |
| 7 | 7 | use Symfony\Component\OptionsResolver\OptionsResolver; |
| 8 | 8 | use Symfony\Component\Translation\TranslatorInterface; |
| 9 | -use LoginCidadao\CoreBundle\Form\DataTransformer\StateToStringTransformer; |
|
| 10 | 9 | use LoginCidadao\CoreBundle\Entity\Country; |
| 11 | 10 | use Doctrine\ORM\EntityManager; |
| 12 | -use Doctrine\ORM\EntityRepository; |
|
| 13 | 11 | use Symfony\Component\Form\FormEvent; |
| 14 | 12 | use Symfony\Component\Form\FormEvents; |
| 15 | 13 | use LoginCidadao\CoreBundle\Entity\State; |
| 16 | -use LoginCidadao\CoreBundle\Entity\City; |
|
| 17 | 14 | use LoginCidadao\CoreBundle\Entity\PersonAddress; |
| 18 | 15 | use LoginCidadao\CoreBundle\Model\SelectData; |
| 19 | 16 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function buildForm(FormBuilderInterface $builder, array $options) |
| 30 | 30 | { |
| 31 | 31 | $builder->addEventListener(FormEvents::PRE_SET_DATA, |
| 32 | - function (FormEvent $event) { |
|
| 32 | + function(FormEvent $event) { |
|
| 33 | 33 | $form = $event->getForm()->getParent(); |
| 34 | 34 | $person = $form->getData(); |
| 35 | 35 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $form->add('city', new CitySelectorComboType($person->getState())); |
| 40 | 40 | }); |
| 41 | 41 | $builder->addEventListener(FormEvents::PRE_SUBMIT, |
| 42 | - function (FormEvent $event) { |
|
| 42 | + function(FormEvent $event) { |
|
| 43 | 43 | $data = $event->getData(); |
| 44 | 44 | $form = $event->getForm()->getParent(); |
| 45 | 45 | |
@@ -151,6 +151,10 @@ |
||
| 151 | 151 | return $translated; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | + /** |
|
| 155 | + * @param SecurityHelper $securityHelper |
|
| 156 | + * @param \Symfony\Component\Security\Core\SecurityContext $security |
|
| 157 | + */ |
|
| 154 | 158 | public static function filterRoles(PersonInterface $person, |
| 155 | 159 | PersonInterface $loggedUser, |
| 156 | 160 | FormInterface $form, array $roles, |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace LoginCidadao\CoreBundle\Form\Type; |
| 4 | 4 | |
| 5 | 5 | use Symfony\Component\Form\FormBuilderInterface; |
| 6 | -use Doctrine\ORM\EntityRepository; |
|
| 7 | 6 | use Symfony\Component\Form\FormEvent; |
| 8 | 7 | use Symfony\Component\Form\FormEvents; |
| 9 | 8 | use LoginCidadao\CoreBundle\Form\Type\CommonFormType; |
@@ -152,9 +152,9 @@ |
||
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | public static function filterRoles(PersonInterface $person, |
| 155 | - PersonInterface $loggedUser, |
|
| 156 | - FormInterface $form, array $roles, |
|
| 157 | - $securityHelper, $security) |
|
| 155 | + PersonInterface $loggedUser, |
|
| 156 | + FormInterface $form, array $roles, |
|
| 157 | + $securityHelper, $security) |
|
| 158 | 158 | { |
| 159 | 159 | $loggedUserLevel = $securityHelper->getLoggedInUserLevel(); |
| 160 | 160 | $targetPersonLevel = $securityHelper->getTargetPersonLevel($person); |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | $securityHelper = $this->securityHelper; |
| 77 | 77 | $security = $this->security; |
| 78 | 78 | $builder->addEventListener(FormEvents::PRE_SET_DATA, |
| 79 | - function (FormEvent $event) use ($user, &$allRoles, &$securityHelper, &$security) { |
|
| 79 | + function(FormEvent $event) use ($user, &$allRoles, &$securityHelper, &$security) { |
|
| 80 | 80 | $person = $event->getData(); |
| 81 | 81 | $form = PersonResumeFormType::populateCountryStateCity($person, |
| 82 | 82 | $event->getForm()); |