Open reinvanleirsberghe opened 10 years ago
No, it isn't possible to do method injection in the CommandHandlers. You can still do dependency injection, but only in the constructor.
Not possible right now, but I can add that in, definitely.
And this could be a good Laracast lesson!
Isn't method injection in handlers a bit unnecessary? Their only public interface is the handle() method, so method injection will only be available there anyway.
I think method injection would be cool if we have a way to "SelfHandling" the commands, like L5.
So, a handle
method in the Command
class will make sense to have dependency injection.
Hey Jeffrey!
I am trying to do method injection in a CommandHandler class like so: public function handle($command, \UserRepository $userRepository)
Still, I'm getting the following error: Declaration of Site\Registration\RegisterUserCommandHandler::handle() must be compatible with Laracasts\Commander\CommandHandler::handle($command)
Is it even possible to do method injection here?