controller - launch command from url in Symfony 2.5 -
i try eg router:debug slug :
there no commands defined in "router" namespace.
/** * method * * @route("/command-execute/{slug}", name="execute") * * @template() * */ public function executeaction($slug) { //todo add params , add security $kernel = $this->get('kernel'); $application = new application($kernel); $application->setautoexit(false); $options = array('command' => $slug); $input = new arrayinput($options); $output = new streamoutput(fopen('php://temp', 'w')); $application->dorun($input, $output); rewind($output->getstream()); $response = stream_get_contents($output->getstream()); //<pre> output of string array on layout echo '<pre>'; return array('response'=> $response); }
any idea's ?
try find command ->find($slug)
, after perform $command->run($input, $output);
Comments
Post a Comment