title: Symfony 3.4 Attempted to call an undefined method named "createQueryBuilder" of class "AppBundle\Entity\User"
body: <p>I generated entities and forms with symfony and tried to create a simple form. But I get an error which I cannot solve.</p>
  
  <p>Attempted to call an undefined method named "createQueryBuilder" of class "AppBundle\Entity\User".</p>
  
  <p>Controller:</p>
  
  <pre><code>public function groupedit(Request $request) {
      $group = new Group();
      $form = $this-&gt;createForm(GroupType::class, $group);
  
      $form-&gt;handleRequest($request);
  
      return $this-&gt;render(
                      'form.html.twig', array('form', $form-&gt;createView())
      );
  }
  </code></pre>
  
  <p>User YML</p>
  
  <pre><code>AppBundle\Entity\User:
    type: entity
    repositoryClass: User
    id:
      id:
        type: integer
        generator:
          strategy: AUTO
    fields:
      xxx
    manyToMany:
      mailForwarder:
        targetEntity: AppBundle\Entity\MailForwarder
        inversedBy: user
        joinTable:
          name: MailForwarderHasUser
          joinColumns:
            user_id:
              referencedColumnName: id
              nullable: false
          inverseJoinColumns:
            mail_forwarder_id:
              referencedColumnName: id
              nullable: false
      group:
        targetEntity: AppBundle\Entity\Group
        mappedBy: user
  </code></pre>
  
  <p>Group YML</p>
  
  <pre><code>AppBundle\Entity\Group:
    type: entity
    repositoryClass: AppBundle\Entity\Group
    id:
      id:
        type: integer
        generator:
          strategy: AUTO
    fields:
      xx
    oneToMany:
      sharedMailbox:
        targetEntity: AppBundle\Entity\SharedMailbox
        mappedBy: group
    manyToMany:
      user:
        targetEntity: AppBundle\Entity\User
        inversedBy: group
        joinTable:
          name: UserHasGroup
          joinColumns:
            group_id:
              referencedColumnName: id
              nullable: false
          inverseJoinColumns:
            user_id:
              referencedColumnName: id
              nullable: false
  </code></pre>
  
  <p>User Entity</p>
  
  <pre><code>class User implements UserInterface, \Serializable
  {
  
      /**
       * @var \Doctrine\Common\Collections\Collection
       */
      private $mailForwarder;
  
      /**
       * @var \Doctrine\Common\Collections\Collection
       */
      private $group;
  
      xxx
  
      /**
       * Add mailForwarder
       *
       * @param \AppBundle\Entity\MailForwarder $mailForwarder
       *
       * @return User
       */
      public function addMailForwarder(\AppBundle\Entity\MailForwarder $mailForwarder)
      {
          $this-&gt;mailForwarder[] = $mailForwarder;
  
          return $this;
      }
  
      /**
       * Remove mailForwarder
       *
       * @param \AppBundle\Entity\MailForwarder $mailForwarder
       */
      public function removeMailForwarder(\AppBundle\Entity\MailForwarder $mailForwarder)
      {
          $this-&gt;mailForwarder-&gt;removeElement($mailForwarder);
      }
  
      /**
       * Get mailForwarder
       *
       * @return \Doctrine\Common\Collections\Collection
       */
      public function getMailForwarder()
      {
          return $this-&gt;mailForwarder;
      }
  
      /**
       * Add group
       *
       * @param \AppBundle\Entity\Group $group
       *
       * @return User
       */
      public function addGroup(\AppBundle\Entity\Group $group)
      {
          $this-&gt;group[] = $group;
  
          return $this;
      }
  
      /**
       * Remove group
       *
       * @param \AppBundle\Entity\Group $group
       */
      public function removeGroup(\AppBundle\Entity\Group $group)
      {
          $this-&gt;group-&gt;removeElement($group);
      }
  
      /**
       * Get group
       *
       * @return \Doctrine\Common\Collections\Collection
       */
      public function getGroup()
      {
          return $this-&gt;group;
      }
  }
  </code></pre>
  
  <p>Group Entity</p>
  
  <pre><code>class Group
  {
  
      XXX
  
      /**
       * @var \Doctrine\Common\Collections\Collection
       */
      private $sharedMailbox;
  
      /**
       * @var \Doctrine\Common\Collections\Collection
       */
      private $user;
  
      XXX
  
      /**
       * Add sharedMailbox
       *
       * @param \AppBundle\Entity\SharedMailbox $sharedMailbox
       *
       * @return Group
       */
      public function addSharedMailbox(\AppBundle\Entity\SharedMailbox $sharedMailbox)
      {
          $this-&gt;sharedMailbox[] = $sharedMailbox;
  
          return $this;
      }
  
      /**
       * Remove sharedMailbox
       *
       * @param \AppBundle\Entity\SharedMailbox $sharedMailbox
       */
      public function removeSharedMailbox(\AppBundle\Entity\SharedMailbox $sharedMailbox)
      {
          $this-&gt;sharedMailbox-&gt;removeElement($sharedMailbox);
      }
  
      /**
       * Get sharedMailbox
       *
       * @return \Doctrine\Common\Collections\Collection
       */
      public function getSharedMailbox()
      {
          return $this-&gt;sharedMailbox;
      }
  
      /**
       * Add user
       *
       * @param \AppBundle\Entity\User $user
       *
       * @return Group
       */
      public function addUser(\AppBundle\Entity\User $user)
      {
          $this-&gt;user[] = $user;
  
          return $this;
      }
  
      /**
       * Remove user
       *
       * @param \AppBundle\Entity\User $user
       */
      public function removeUser(\AppBundle\Entity\User $user)
      {
          $this-&gt;user-&gt;removeElement($user);
      }
  
      /**
       * Get user
       *
       * @return \Doctrine\Common\Collections\Collection
       */
      public function getUser()
      {
          return $this-&gt;user;
      }
  }
  </code></pre>
  
  <p>Group Form Type</p>
  
  <pre><code>&lt;?php
  
  namespace AppBundle\Form;
  
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  use Symfony\Component\OptionsResolver\OptionsResolver;
  
  class GroupType extends AbstractType
  {
      /**
       * {@inheritdoc}
       */
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder-&gt;add('name')-&gt;add('systemgroup')-&gt;add('user');
      }/**
       * {@inheritdoc}
       */
      public function configureOptions(OptionsResolver $resolver)
      {
          $resolver-&gt;setDefaults(array(
              'data_class' =&gt; 'AppBundle\Entity\Group'
          ));
      }
  
      /**
       * {@inheritdoc}
       */
      public function getBlockPrefix()
      {
          return 'appbundle_group';
      }
  
  
  }
  </code></pre>
  
  <p>Have someone an idea where the problem is?</p>
  
  <p>Best regards,</p>
  
  <p>Alex</p>