title: Expected argument of type "string", "App\Entity" given
body: <p>I try to insert records with relations OneToMany-ManyToOne, but I got error. </p>
  
  <pre><code>Expected argument of type "string", "App\Entity\Question" given.
  </code></pre>
  
  <p>I have next entities <code>question</code> and <code>answer</code>.</p>
  
  <pre><code>class Question
  {
      /**
       * @ORM\Id()
       * @ORM\GeneratedValue()
       * @ORM\Column(type="integer")
       */
      private $id;
  /**
   * @ORM\Column(type="text")
   */
  private $title;
  
  /**
   * @ORM\OneToMany(targetEntity="App\Entity\Answer", mappedBy="question", orphanRemoval=true)
   */
  private $answers;
  
  public function __construct()
  {
      $this-&gt;answers = new ArrayCollection();
  }
  
  public function getId(): ?int
  {
      return $this-&gt;id;
  }
  
  public function getTitle(): ?string
  {
      return $this-&gt;title;
  }
  
  public function setTitle(string $title): self
  {
      $this-&gt;title = $title;
  
      return $this;
  }
  
  /**
   * @return Collection|Answer[]
   */
  public function getAnswers(): Collection
  {
      return $this-&gt;answers;
  }
  
  public function addAnswer(Answer $answer): self
  {
      if (!$this-&gt;answers-&gt;contains($answer)) {
          $this-&gt;answers[] = $answer;
          $answer-&gt;setQuestion($this);
      }
  
      return $this;
  }
  
  public function removeAnswer(Answer $answer): self
  {
      if ($this-&gt;answers-&gt;contains($answer)) {
          $this-&gt;answers-&gt;removeElement($answer);
          if ($answer-&gt;getQuestion() === $this) {
              $answer-&gt;setQuestion(null);
          }
      }
  
      return $this;
  }
  }
  </code></pre>
  
  <p>Entity <code>Answer</code></p>
  
  <pre><code>class Answer
  {
      /**
       * @ORM\Id()
       * @ORM\GeneratedValue()
       * @ORM\Column(type="integer")
       */
      private $id;
  /**
   * @ORM\Column(type="text")
   */
  private $text;
  
  /**
   * @ORM\Column(type="boolean")
   */
  private $is_correct;
  
  /**
   * @ORM\ManyToOne(targetEntity="App\Entity\Question", inversedBy="answers")
   * @ORM\JoinColumn(nullable=false)
   */
  private $question;
  
  public function getId(): ?int
  {
      return $this-&gt;id;
  }
  
  public function getText(): ?string
  {
      return $this-&gt;text;
  }
  
  public function setText(string $text): self
  {
      $this-&gt;text = $text;
  
      return $this;
  }
  
  public function getIsCorrect(): ?bool
  {
      return $this-&gt;is_correct;
  }
  
  public function setIsCorrect(bool $is_correct): self
  {
      $this-&gt;is_correct = $is_correct;
  
      return $this;
  }
  
  public function getQuestion(): ?question
  {
      return $this-&gt;question;
  }
  
  public function setQuestion(?Question $question): self
  {
      $this-&gt;question = $question;
  
      return $this;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>My form </p>
  
  <pre><code>public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $builder
          -&gt;add('title', EntityType::class, array(
              'class' =&gt; Question::class,
              'choice_label' =&gt; 'title',
              'label' =&gt; 'Question'
          ));
      $builder
          -&gt;add('answers', CollectionType::class, array(
          'entry_type' =&gt; AnswerType::class,
          'entry_options' =&gt; array('label' =&gt; false),
          'allow_add' =&gt; true,
          'by_reference'  =&gt; false,
  ));
      $builder
          -&gt;add('create', SubmitType::class, ['label' =&gt; 'Add', 'attr' =&gt; ['class' =&gt; 'btn btn-primary']]);
  
  
  }
  
  public function configureOptions(OptionsResolver $resolver)
  {
      $resolver-&gt;setDefaults([
          'data_class' =&gt; Question::class
      ]);
  }
  </code></pre>
  
  <p>My fragment of controller</p>
  
  <pre><code> $question = new Question();
   $answer = new Answer();
   $question-&gt;addAnswer($answer);
   $form1 = $this-&gt;createForm(QuestionAnswerType::class, $question);
   $form1-&gt;handleRequest($request);
      if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
          $em = $this-&gt;getDoctrine()-&gt;getManager();
          $em-&gt;persist($question);
          $em-&gt;flush();
      }
  </code></pre>
  
  <p>The error pointer at next line </p>
  
  <pre><code> $form1-&gt;handleRequest($request);
  </code></pre>
  
  <p>I know I have problem with my controller, but I don't know how resolve it.</p>
  
  <p>I don't get it how right insert records with relations OneToMany-ManyToOne. Could you help me?</p>