title: Symfony 2.7.7 - Form Collection "Notice: Undefined index: pageId"
body: <p>Trying to generate a form in which it will be a collection of Contents, but unfortunately bereave her mistake and do not know how we recover.</p>
  <p><strong>Gives me the error</strong></p>
  <blockquote>
  <p>Notice: Undefined index: pageId</p>
  <p>500 Internal Server Error - ContextErrorException</p>
  </blockquote>
  <p>Page Entity:</p>
  <pre><code>class Page
  {
      private $id;
      private $name;
      /**
       * @ORM\OneToMany(targetEntity = &quot;PageContent&quot;, mappedBy = &quot;pageId&quot;)
       */
      private $content;
  }
  </code></pre>
  <p>PageContent Entity:</p>
  <pre><code>class PageContent
  {
      private $id;
  
      /**
       * @ORM\ManyToOne(targetEntity = &quot;Page&quot;, inversedBy = &quot;page_content&quot;)
       * @ORM\JoinColumn(name = &quot;page_id&quot;, referencedColumnName = &quot;id&quot;, onDelete = &quot;SET NULL&quot;)
       */
      private $page;
      private $name;
  }
  </code></pre>
  <p>EditPageContentsType :</p>
  <pre><code>&lt;?php
  namespace Eteam\SettingsBundle\Form\Type;
  
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  use Symfony\Component\OptionsResolver\OptionsResolver;
  
  class EditPageContentsType extends AbstractType
  {
      /**
       * Returns the name of this type.
       *
       * @return string The name of this type
       */
      public function getName()
      {
          return 'EditPageContents';
      }
  
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              -&gt;add('pageContentMap')
              -&gt;add('content', 'collection', array(
                  'type' =&gt; new PageContentType(),
                  'options'  =&gt; array(
                      'required'  =&gt; false
                  ),
                  'allow_add' =&gt; true
              ));
  
      }
  
      public function configureOptions(OptionsResolver $resolver)
      {
          $resolver-&gt;setDefaults(array(
              'data_class' =&gt; 'Eteam\PageBundle\Entity\Page',
          ));
      }
  }
  </code></pre>
  <p>PageContentType:</p>
  <pre><code>&lt;?php
  namespace Eteam\SettingsBundle\Form\Type;
  
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  use Symfony\Component\OptionsResolver\OptionsResolver;
  
  class PageContentType extends AbstractType
  {
  
      /**
       * Returns the name of this type.
       *
       * @return string The name of this type
       */
      public function getName()
      {
          return 'pageContent';
      }
  
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
  
          $builder
              -&gt;add('name', 'text', array(
                  'label' =&gt; 'Test'
              ))
              -&gt;add('content')
              -&gt;add('type')
              -&gt;add('pageId');
      }
  
      public function configureOptions(OptionsResolver $resolver)
      {
          $resolver-&gt;setDefaults(array(
              'data_class' =&gt; 'Eteam\PageBundle\Entity\PageContent',
          ));
      }
  }
  </code></pre>
  <p>I will be grateful for your help.</p>
  <p>Because of this I'm a beginner here and in Synfony 2, please do not click negatives. Thanks.</p>
  <hr />
  <p>P.S.</p>
  <p>If you need more information please let me know.</p>