You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, a Symfony command can only implement a single action supplied in its execute() method, though sometimes it's quite useful to call multiple commands sequentially (for example, if we were deploying a Symfony application on a remote host, we'd need to do a bunch of actions).
I suggest to somehow allow commands to call other commands or have a single command /depend/ on others. Here's how it could look.
First option: we could allow specifying commands to call in the configure method:
class SomeCompositeCommand extends ContainerAwareCommand
{
protectedfunctionconfigure()
{
$this
->setName('my:composite:command')
->setDescription('Runs a bunch of other commands')
->setCalledCommands(array(
'doctrine:schema:validate',
'doctrine:schema:create',
'cache:clear'
))
;
}
}
Second option: we could provide a method to call other commands inside the execute method:
Both these options would be pretty hard to implement, though I personally think that the second one is better. Also, some questions arise, like, how do we provide arguments to the commands we call (but having an invokeCommand method suggests an easy API here).
The text was updated successfully, but these errors were encountered:
note however that all these commands will run in the same process, and some command will not play well with this (for instance clearing or warming up the cache, as they change some class definitions, so running something after them is likely to break)
Currently, a Symfony command can only implement a single action supplied in its
execute()
method, though sometimes it's quite useful to call multiple commands sequentially (for example, if we were deploying a Symfony application on a remote host, we'd need to do a bunch of actions).I suggest to somehow allow commands to call other commands or have a single command /depend/ on others. Here's how it could look.
First option: we could allow specifying commands to call in the
configure
method:Second option: we could provide a method to call other commands inside the
execute
method:Both these options would be pretty hard to implement, though I personally think that the second one is better. Also, some questions arise, like, how do we provide arguments to the commands we call (but having an
invokeCommand
method suggests an easy API here).The text was updated successfully, but these errors were encountered: