title: Symfony Form Select2 Allow User to Enter New Values
body: <p>I have a Symfony Form in which I have a field of Province, that convert it into Select2. I want to allow user to allow new values also.</p>
  
  <pre><code> -&gt;add('province', 'entity', array(
                  'class' =&gt; 'PNC\GeneralBundle\Entity\State',
                  'property' =&gt; 'name',
                  'empty_value'=&gt;'-- Select Province --',
                  'label' =&gt; ucfirst('State / Province / Region'),
                  'required'  =&gt; false,
                  'attr' =&gt; array('class' =&gt; 'form-control'),
                  'label_attr' =&gt; array('class' =&gt; 'control-label'),
                  'mapped' =&gt; false,
              ))
  </code></pre>
  
  <p><strong>twig</strong></p>
  
  <pre><code>$('#user_profile_type_province').select2({
      tags: "true",
  });
  </code></pre>
  
  <p><strong>controller</strong></p>
  
  <pre><code>if ($request-&gt;getMethod() == 'POST') {
   $UserProfileForm-&gt;handleRequest($request);
   $province = $UserProfileForm["province"]-&gt;getData();
   $tag = $em-&gt;getRepository('PNCGeneralBundle:State')-&gt;findOneByName($province);
   if(!$tag){
     $newState = new State();
     $newState-&gt;setName($province);
     $newState-&gt;setCountry($UserProfileForm["country"]-&gt;getData());
     $em-&gt;persist($newState);
     $em-&gt;flush();
     }
  }
  </code></pre>
  
  <p>but I am getting <code>province</code> value <code>null</code> when I new input in province select2.</p>