Explorar o código

Add yucky workaround to satisfy people on 5.3

Dave Shoreman %!s(int64=11) %!d(string=hai) anos
pai
achega
0ea59eda22
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      src/Packagist/WebBundle/Form/Type/ProfileFormType.php

+ 4 - 2
src/Packagist/WebBundle/Form/Type/ProfileFormType.php

@@ -28,12 +28,14 @@ class ProfileFormType extends BaseType
         $builder->add('username', null, array('label' => 'form.username', 'translation_domain' => 'FOSUserBundle'))
                 ->add('email', 'email', array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle'));
 
-        $builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event)
+        // Horrible hack for people stuck in the past on PHP5.3
+        $self = $this;
+        $builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) use ($self)
         {
             if ( ! ($user = $event->getData())) return;
 
             if ( ! $user->getGithubId()) {
-                $this->addPasswordField($event);
+                $self->addPasswordField($event);
             }
         });