title: The form's view data is expected to be an instance of class My\(...), but is a(n) array
body: <p>Error that appears:</p>
  
  <blockquote>
    <p>The form's view data is expected to be an instance of class
    My\FrontendBundle\Entity\Intro, but is a(n) array. You can avoid this
    error by setting the "data_class" option to null or by adding a view
    transformer that transforms a(n) array to an instance of
    My\FrontendBundle\Entity\Intro.</p>
  </blockquote>
  
  <p><strong>What is wrong?</strong></p>
  
  <p>In DefaultController.php I have</p>
  
  <pre><code>public function formularzAction(){
          $Repo = $this-&gt;getDoctrine()-&gt;getRepository('MyFrontendBundle:Intro');
          $Register = $Repo-&gt;findAll();
          $form = $this-&gt;createForm(new EditType(), $Register);
          return array(
              'form' =&gt; $form-&gt;createView(),
              'rows' =&gt; $Register
          );
      }
  </code></pre>
  
  <p>my EditType.php</p>
  
  <pre><code>&lt;?php
  namespace My\FrontendBundle\Form\Type;
  
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  
  class EditType extends AbstractType{
      public function getName(){
          return 'register_form';
      }
      public function buildForm(FormBuilderInterface $builder, array $options) {
          $builder
                  -&gt;add('info', 'textarea', array(
                      'constraints' =&gt; array(
                          ),
                      'label' =&gt; 'Informacje dodatkowe'
                  ))
              ;
      }
      public function setDefaultOptions(\Symfony\Component\OptionsResolver\OptionsResolverInterface $resolver) {
          $resolver-&gt;setDefaults(array(
              'data_class' =&gt; 'My\FrontendBundle\Entity\Intro'
          ));
          }   
  }
  </code></pre>
  
  <p>my Intro.php:</p>
  
  <pre><code>&lt;?php
  
  namespace My\FrontendBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * Intro
   *
   * @ORM\Table()
   * @ORM\Entity
   */
  class Intro
  {
      /**
       * @var integer
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @var string
       *
       * @ORM\Column(name="info", type="string", length=2500)
       */
      private $info;
  
  
      /**
       * Get id
       *
       * @return integer 
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  
      /**
       * Set info
       *
       * @param string $info
       * @return Intro
       */
      public function setInfo($info)
      {
          $this-&gt;info = $info;
  
          return $this;
      }
  
      /**
       * Get info
       *
       * @return string 
       */
      public function getInfo()
      {
          return $this-&gt;info;
      }
  }
  </code></pre>