title: Symfony3 get the value of a non mapped field in event listener
body: <p>Trying to make a form that a user chooses an option and depending on their choice loads additional fields. So far I have a UserSignupType:</p>
  
  <pre><code>class UserSignupType extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              -&gt;add('userType', ChoiceType::class, array(
                  'choices' =&gt; array(
                      "Subscriber" =&gt; "Subscriber",
                      "Friend" =&gt; "Friend"
                      ),
                  'expanded' =&gt; true,
                  'mapped' =&gt; false
                  ));
  
          $builder-&gt;addEventListener(
              FormEvents::PRE_SET_DATA,
              function (FormEvent $event) {
                  $form = $event-&gt;getForm();
  
                  $usertype = $form-&gt;get('userType')-&gt;getData(); //updated per JBaffords answer
  
                  if($userType == "Subscriber")
                  {
                      $builder-&gt;add('agency', EntityType::class, array(
                          "class" =&gt; "\AppBundle\Entity\Agency",
                          "label" =&gt; "name"));
                  }
                  elseif($userType == "Friend")
                  {
                      $builder-&gt;add('phoneNumber', PhoneNumberType::class, array(
                          'default_region' =&gt; 'US',
                          'format' =&gt; PhoneNumberFormat::NATIONAL));
                  }
              }
          );
      }
  
      // ...
  }
  </code></pre>
  
  <p>not sure if the getData method is the right method to use, and if it is, i need to somehow get the "userType" field out of it. I cant call getUserType because its not an actual mapped property and I don't want it to be. It simply decides the fields to show.</p>