-
-
Notifications
You must be signed in to change notification settings - Fork 964
Allow to set Custom namespace for commands, also #919
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
Conversation
allow to set custom array as CommandPath to prevent vendors commands and define your own commands outside vendor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge this change ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
By this change override commands out of vendor's folder ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, in my opinion this feature is need.
*/ | ||
public function setCommandsPath(array $paths) | ||
{ | ||
$this->commands_paths = $paths; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@imami Best to set as an empty array and then use the existing addCommandsPaths
method to add paths. Just to ensure the reuse of code.
@@ -277,7 +298,7 @@ public function getCommandObject($command) | |||
$which[] = 'User'; | |||
|
|||
foreach ($which as $auth) { | |||
$command_namespace = __NAMESPACE__ . '\\Commands\\' . $auth . 'Commands\\' . $this->ucfirstUnicode($command) . 'Command'; | |||
$command_namespace = $this->commands_namespace . $auth . 'Commands\\' . $this->ucfirstUnicode($command) . 'Command'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd vote for having this as $this->commands_namespace . '\\' . $auth . 'Commands\\'
, to not require the final backslashes when setting the namespace.
Added
setCommandsNamespace()
andsetCommandsPath()
methods to prevent vendors commands and define your own commands outside vendor. before to these changes, you must override vendor's commands likeStartCommand
with the same namespace, wich might cause PHP exception of class redeclaration.