Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

imami
Copy link

@imami imami commented Jan 23, 2019

Added setCommandsNamespace() and setCommandsPath() methods to prevent vendors commands and define your own commands outside vendor. before to these changes, you must override vendor's commands like StartCommand with the same namespace, wich might cause PHP exception of class redeclaration.

allow to set custom array as CommandPath to prevent vendors commands and define your own commands outside vendor
@noplanman noplanman changed the base branch from master to develop January 26, 2019 15:03
Copy link

@vdavari vdavari left a 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 ...

Copy link

@vdavari vdavari left a 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 ...

Copy link

@ImanX ImanX left a 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;
Copy link
Member

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';
Copy link
Member

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.

@noplanman
Copy link
Member

@imami Thanks for the PR, but as far as I can see, #689 supersedes this, right?

Or do you have a different scenario that isn't covered by the other PR?

@noplanman noplanman closed this Jun 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants