Answer the question
In order to leave comments, you need to log in
How to use interface in DI Symfony 3?
I'm trying to pass a class to the constructor. All settings are set.
This is how it works (ShipRepository implements IShipRepository ):
public function __construct(\AppBundle\Infrastructure\Persistence\ShipRepository $shipRepo)
public function __construct(IShipRepository $shipRepo)
Type error: Argument 1 passed to AppBundle\Newsletter\NewsletterManager::__construct() must be an instance of AppBundle\Domain\Repositories\IShipRepository, instance of AppBundle\Infrastructure\Persistence\ShipRepository given, called in \var\cache\dev\appDevDebugProjectContainer.php on line 338
500 Internal Server Error - FatalThrowableError
Answer the question
In order to leave comments, you need to log in
Can. You are doing something wrong. The class and interface code is not shown, the error is not shown, the container config is not shown - what are we talking about?
public function __construct(IShipRepository $shipRepo)
To use such an entry, you must first do a use.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question