setName("label:render"); $this->setDescription("Render a label"); $this->addOption("define", "D", InputOption::VALUE_REQUIRED|InputOption::VALUE_IS_ARRAY, "key=value pairs to pass to use in the template"); } protected function execute(InputInterface $input, OutputInterface $output) { $renderer = $this->getContainer()->get("gdlabel.renderer"); $params = []; foreach ($input->getOption("define") as $opt) { list ($key, $value) = explode("=", $opt, 2); $params[$key] = $value; } echo $renderer->renderToData("@InventoryBundle/Resources/labels/inventoryreceipt.xml", $params); } }