Skip to content


Refactoring "hub" commands #91

willdurand opened this Issue · 2 comments

2 participants

Propel member

Some commands are using other commands but in a wrong way. We should refactor that part.

The existing code is more or less as below:


$cmd = new FooCommand();

This is wrong and I don't know how it can work.. The execute() method is protected.

The right way is:


$in = new ArrayInput(array(
       'command'        => 'foo',
       '--verbose'      => $input->getOption('verbose'),

$cmd = $this->getApplication()->find('foo');
$cmd->run($in, $output);
Propel member

It works because each of these FooCommand is a AbstractPropelCommand. Since both objects are of the class defining the protected method and a spicy PHP bug (or feature?), they are allowed to call "their" protected method.

Propel member

Maybe, I discovered the right way when I started to work on Propel2 commands..

@willdurand willdurand closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.