Comments (15)
That's because the command class you're extending already has an execute method. So, when you pull in the trait, they're clashing.
from commander.
I know, I figured it out after a bit of head-scratching :-)
I know it would break backwards-compatibility to change the method name, so I guess we can either close it or maybe create a wrapper trait for artisan commands. I used this package in all my CLI commands and it makes a lot of sense (CLI and Web are both external facing parts of the app). What do you think?
from commander.
Maybe a more explicit executeCommand function name would be more semantic anyways?
from commander.
+1 - It wouldn't be backwards compatible, but I also think 'executeCommand' would be a better method name
from commander.
Does anyone know of a way around it without modifying the CommanderTrait
?
from commander.
@samwalshnz @laracasts @lucacri
http://www.sitepoint.com/using-traits-in-php-5-4/
Use the alias.
use Commander {
Commander::execute as executeCommand
}
(its bad, but if you want to avoid extend/modify the existing commander, its a solution)
from commander.
Oh man! You learn something every day. Thank you @stevenklar!
from commander.
wow. Really nice reference.
from commander.
@stevenklar ... I'm still getting the same error. Can you paste a code that works?
from commander.
use Commander { executeCommand insteadof Commander::execute } should be possible too (according to the link provided above).
from commander.
Unable to use the alias also...
from commander.
@JeffreyWay, not sure if this means this issue should be reopened or not, but I've just tried to use the code examples @juukie14 and @stevenklar have recommended with no success.
from commander.
I am having the same issue with the conflicts too
from commander.
Has anyone solved this?
from commander.
See https://laracasts.com/discuss/channels/general-discussion/laracasts-commander-with-artisan-commands
I used the answer given there but don't use the Trait.
from commander.
Related Issues (20)
- Validation Decorator HOT 3
- Triggering executeDecorators before validateCommand (in ValidationCommandBus) HOT 1
- Laravel 5 HOT 2
- Method injection CommandHandler HOT 5
- Include a demo basic example project in repo HOT 1
- FIX mapInputToCommand accept $input null
- Testing CommandHandlers with PHPSpec?
- PHPSpec a CommandHandler with DispatchableTrait HOT 1
- CommanderTrait method getCommandBus detected as Controller action HOT 1
- Make mapInputToCommand optional in CommanderTrait HOT 7
- Returning created entity HOT 4
- Validation is being fired twice when using ValidationCommandBus
- Could the package allow for custom Mustache templates to be used when generating commands?
- Decorators of the parent command will be executed on the child command HOT 1
- Warning: Ambiguous class resolution HOT 1
- Specify properties types
- Could this be used in laravel 5 HOT 3
- Using CommanderTrait with Console commands
- Javascript Error on Lead deal analysis HOT 1
- Is this project maintained and usable in production? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from commander.