title: Symfony validate telephone in form field
body: <p>I have Symfony 2.6 and form for Personal Information in form field telephone, like rhis</p>
  
  <pre><code>+38 (918) 280-1594
  </code></pre>
  
  <p>and if developer write "_" or more digits, space. How in action I check this ?
  Like developer write </p>
  
  <pre><code>+38 (918) 2 801_594
  </code></pre>
  
  <p>And I set in DB </p>
  
  <pre><code>+38(918)2801594
  </code></pre>
  
  <p>what are the processes and decisions or bundles to solve this problem? </p>
  
  <pre><code>-&gt;add('telephone', null, array('label' =&gt; 'Telephone', 'max_length' =&gt; 255, 'required' =&gt; false));
  
  $builder-&gt;get('telephone')-&gt;addModelTransformer(new CallbackTransformer(
      // transform &lt;br/&gt; to \n so the textarea reads easier
      function ($originalDescription) {
          return preg_replace('/[^0-9()]+/', "", $originalDescription);
      },
      function ($submittedDescription) {
          // remove most HTML tags (but not br,p)
          $cleaned = strip_tags($submittedDescription, '&lt;br&gt;&lt;br/&gt;&lt;p&gt;');
          // transform any \n to real &lt;br/&gt;
          return str_replace("\n", '&lt;br/&gt;', $cleaned);
      }
  ));
  </code></pre>
  
  <p>But how it works? I write telephone 65454### and this "#" write in my DB this is wrong. Why I not Understand? And I need determine the number of digits (12 digits). Maybe Example please. </p>
  
  <p>I post +30632666$$# and in DB set this +30632666$$# but in form visible this 30632666 this is exactly I need in my DB, I need set in database correct telephone and limit 13 chars - one "+" and 12 - digital  </p>