I try to injcect doctrine mongo repository to controller. In services.yaml file I added entry:
App\Account\Repository\MongoAccountRepository:
factory: ["@doctrine_mongodb", getRepository]
arguments:
- App\Account\Domain\Entity\Account
In my code I want to use repositories hidden behind the interface AccountRepository
class MongoAccountRepository extends DocumentRepository implements AccountRepository {}
When I try to inject repository to controller constructor
class DefaultController extends Controller
{
private $accountRepository;
public function __construct(AccountRepository $accountRepository) {
$this->accountRepository = $accountRepository;
}
I get following error:
Argument 1 passed to App\Account\UserInterface\DefaultController::__construct() must implement interface App\Account\Domain\Repository\AccountRepository, instance of Doctrine\ODM\MongoDB\DocumentRepository given
Has someone similar problem?