Reload command does not work
demijohn opened this issue · comments
Bug Report
Q | A |
---|---|
Version(s) | 3.1.0 |
Summary
Executing Reload command from CLI throw errors.
Current behavior
Reloading server ...
PHP Notice: Undefined index: stop in /usr/src/project/vendor/laminas/laminas-cli/src/AbstractContainerCommandLoader.php on line 64
Notice: Undefined index: stop in /usr/src/project/vendor/laminas/laminas-cli/src/AbstractContainerCommandLoader.php on line 64
Command "stop" is not defined.
Did you mean this?
mezzio:swoole:stop
How to reproduce
./vendor/bin/laminas mezzio:swoole:start -d
./vendor/bin/laminas mezzio:swoole:reload
Expected behavior
Callling Reload command from CLI should reload Swoole server.
Fix
I think Symfony Console (method find() of Application class) can not find command when using short name (stop vs. mezzio:swoole:stop)?
This line from ReloadCommand
https://github.com/mezzio/mezzio-swoole/blob/3.1.0/src/Command/ReloadCommand.php#L78
should be replaced with:
$stop = $application->find('mezzio:swoole:stop');
and this line:
https://github.com/mezzio/mezzio-swoole/blob/3.1.0/src/Command/ReloadCommand.php#L95
should be replaced with:
$stop = $application->find('mezzio:swoole:start');
Fixed in #49