Coder Social home page Coder Social logo

Comments (15)

 avatar commented on August 31, 2024

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.

lucacri avatar lucacri commented on August 31, 2024

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.

abbajbryant avatar abbajbryant commented on August 31, 2024

Maybe a more explicit executeCommand function name would be more semantic anyways?

from commander.

samwalshnz avatar samwalshnz commented on August 31, 2024

+1 - It wouldn't be backwards compatible, but I also think 'executeCommand' would be a better method name

from commander.

samwalshnz avatar samwalshnz commented on August 31, 2024

Does anyone know of a way around it without modifying the CommanderTrait?

from commander.

stevenklar avatar stevenklar commented on August 31, 2024

@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.

samwalshnz avatar samwalshnz commented on August 31, 2024

Oh man! You learn something every day. Thank you @stevenklar!

from commander.

bruno-barros avatar bruno-barros commented on August 31, 2024

wow. Really nice reference.

from commander.

arthurkirkosa avatar arthurkirkosa commented on August 31, 2024

@stevenklar ... I'm still getting the same error. Can you paste a code that works?

from commander.

juukie avatar juukie commented on August 31, 2024

use Commander { executeCommand insteadof Commander::execute } should be possible too (according to the link provided above).

from commander.

mdurao avatar mdurao commented on August 31, 2024

Unable to use the alias also...

from commander.

samwalshnz avatar samwalshnz commented on August 31, 2024

@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.

cmgmyr avatar cmgmyr commented on August 31, 2024

I am having the same issue with the conflicts too

from commander.

 avatar commented on August 31, 2024

Has anyone solved this?

from commander.

 avatar commented on August 31, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.