-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Method injection CommandHandler #39
Comments
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 |
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?
The text was updated successfully, but these errors were encountered: