symfony 3 Argument 1 passed to [some service]::__construct() must be an instance of [something] instance of Doctrine\ORM\EntityRepository given
<p>I am trying to create a service:</p>

<pre><code>&lt;?php

namespace AppBundle\Service;

use AppBundle\Repository\GroupEntityRepositoryInterface;
use AppBundle\Repository\GroupUserRepository;
use AppBundle\Repository\GroupUserRepositoryInterface;
use AppBundle\Entity\Group;
use AppBundle\Repository\GroupRepository;


class GroupUserService
{
    private $groupRepository;
    private $groupUserRepository;



    /**
     * @param GroupRepositoryInterface $groupRepository
     * @param GroupUserRepositoryInterface $groupUserRepository
     */
    public function __construct(GroupRepository $groupRepository /*,  GroupUserRepositoryInterface $groupUserRepository*/)
    {
        $this-&gt;groupRepository = $groupRepository;
        // $this-&gt;groupUserRepository = $groupUserRepository;
    }

    public function deleteGroup(Group $group)
    {
        $this-&gt;groupRepository-&gt;delete($group);
    }

    public function createGroup(Group $group)
    {
        $this-&gt;groupRepository-&gt;add($group);
    }
}
</code></pre>

<p>And I wrote configuration to inject a repository into that service:</p>

<pre><code>services:
#    service_name:
#        class: AppBundle\Directory\ClassName
#        arguments: ["@another_service_name", "plain_value", "%parameter_name%"]

    group_repository:
        class: AppBundle\Repository\GroupRepository
        factory: ["@doctrine.orm.entity_manager", getRepository]
        arguments:
          - AppBundle\Entity\Group

    group_user_repository:
        class: AppBundle\Repository\GroupUserRepository
        factory: ["@doctrine.orm.entity_manager", getRepository]
        arguments:
          - AppBundle\Entity\GroupUser

    group_user_service:
        class: AppBundle\Service\GroupUserService
        arguments: ["@group_repository", "@group_user_repository"]
        #arguments:
        #    - "@group_repository"
</code></pre>

<p>I get the error:</p>

<blockquote>
  <p>Catchable Fatal Error: Argument 1 passed to AppBundle\Service\GroupUserService::__construct() must be an instance of AppBundle\Repository\GroupRepository, instance of Doctrine\ORM\EntityRepository given, called in E:\other\dropbox\Dropbox\programavimas\kodo pavyzdziai\htdocs\users_admin_demo\var\cache\dev\appDevDebugProjectContainer.php on line 1654 and defined</p>
</blockquote>

<p>Can you explaing why it gets EntityRepository inststance if I passed GroupRepository? And how to fix it? I tried searching similar questions but after couple of hours I do not see result.</p>

<p><strong>Update:</strong></p>

<pre><code>&lt;?php

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity(repositoryClass="AppBundle\Repository\GroupRepository")
 * Group
 */
class Group
{
    /**
     * @var string
     */
    private $name;

    /**
     * @var integer
     */
    private $id;


    /**
     * Set name
     *
     * @param string $name
     *
     * @return Group
     */
    public function setName($name)
    {
        $this-&gt;name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this-&gt;name;
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this-&gt;id;
    }
}
</code></pre>

<p>Group.orm.xml:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"&gt;
  &lt;entity name="AppBundle\Entity\Group" table="`group`"&gt;
    &lt;unique-constraints&gt;
      &lt;unique-constraint name="UNIQ_6DC044C55E237E06" columns="name"/&gt;
    &lt;/unique-constraints&gt;
    &lt;id name="id" type="integer" column="id"&gt;
      &lt;generator strategy="IDENTITY"/&gt;
    &lt;/id&gt;
    &lt;field name="name" type="string" column="name" length="255" nullable="false"&gt;
      &lt;options&gt;
        &lt;option name="fixed"/&gt;
      &lt;/options&gt;
    &lt;/field&gt;
  &lt;/entity&gt;
&lt;/doctrine-mapping&gt;
</code></pre>