php - Run a command as command line from a symfony function -


how run command command line symfony function?

e.g.

c:\symfonyproject> php app/console my-command --option=my-option 

i want run command function. command export files database , place files in app/resource/translations folder symfony project.

i.e.

public function exportfiles(){ // want run command here. } 

thanks! :)

you use symfony process component that. code this:

private function process(outputinterface $output) {     $cmd = 'php app/console my-command --option=my-option';      $process = new process($cmd);     $process->settimeout(60);      $process->run(         function ($type, $buffer) use ($output) {             $output->write((process::err === $type) ? 'err:' . $buffer : $buffer);         } ); 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -