title: How to map symfony2's form collection field to a doctrine's array type field?
body: <p>I have form (<code>AbstractType</code>) that maps to a (doctrine-persisted) entity.</p>
  
  <p>That entity has got a field which is of doctrine's type <code>array</code>.</p>
  
  <p>According to symfony's docs it should be possible to map a form collection field to a PHP's <code>array</code>, but apparently it does not work when the form is mapped to an entity. Symfony expects that field to be a relation, but it is merely an <code>array</code>.</p>
  
  <p>This is not actual code, just an example:</p>
  
  <p>Consider this (doctrine-persisted) entity:</p>
  
  <pre><code>class Article
  {
     ...
      /**
       * @ORM\Column(type="array")
       */
      protected $tags;   
     ...
  }
  </code></pre>
  
  <p>And this entity (not managed by doctrine):</p>
  
  <pre><code>class Tag
  {
     ...
      public $name;
     ...
  }
  </code></pre>
  
  <p>And this form type:</p>
  
  <pre><code>class ArticleType extends AbstractType
  {
      public function buildForm(FormBuilder $builder, array $options)
      {
          $builder-&gt;add('tags', 'collection', array('type' =&gt; new TagType()));
      }
  
      public function getDefaultOptions(array $options)
      {
          return array(
              'data_class' =&gt; '\Entity\Article',
          );
      }
  }
  </code></pre>
  
  <p>Tag's form type:</p>
  
  <pre><code>class TagType extends AbstractType
  {
      public function buildForm(FormBuilder $builder, array $options)
      {
          $builder-&gt;add('name', 'text');
      }
  
      public function getDefaultOptions(array $options)
      {
          return array(
              'data_class' =&gt; '\Entity\Tag',
          );
      }
  }
  </code></pre>
  
  <p>When trying to instantiate the ArticleType doctrine will complain something along the lines:</p>
  
  <pre><code>Expected argument of type "\Entity\Tag", "array" given
  </code></pre>
  
  <p>In file:</p>
  
  <p><strong>vendor/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php at line 47</strong> </p>
  
  <p>Is it even possible to do what I want without writing my own field type?</p>
  
  <p>UPDATE: Maybe I should rephrase my question: How do I tell symfony not to map this field to anything (if I change its name symfony complains that the entity doesn't have such property)?</p>