/** * @param Input $input * @param Output $output * @return int */ public function execute(Input $input, Output $output) { $router = Routes::getRouter(); $name = $input->getArgument('route'); $bundle = $input->getOption('bundle'); $style = $input->getOption('detail'); if (false !== strpos($bundle, ':')) { $bundle = str_replace(':', '\\', $bundle); } if (null === $name) { $this->showRouteCollections($router, $output, $bundle, $style ? self::STYLE_DETAIL : self::STYLE_LIST); } else { try { $route = $router->getRoute($name); } catch (\Exception $e) { $method = 'GET'; $path = $name; if (false !== ($index = strpos($name, ':'))) { $method = substr($name, 0, $index); $path = substr($name, $index + 1); } // Match all routes. try { $route = $router->getRoute($path); } catch (\Exception $e) { $route = $router->dispatch($method, $path); } } $this->formatOutput($route, $output, self::STYLE_DETAIL); } return 0; }
/** * @param Input $input * @param Output $output * @return int */ public function execute(Input $input, Output $output) { $connection = $input->getArgument('connection'); if (empty($connection)) { $connection = 'read'; } $bundle = $input->getOption('bundle'); $driver = $this->getDriver($connection); $parser = new SchemaParser($driver, true); if (null !== $bundle) { $bundle = $this->getContainer()->singleton('kernel')->getBundle($bundle); $path = $bundle->getRootPath() . '/ORM/' . ucfirst($this->rename($driver->getDbName())); $namespace = $bundle->getNamespace() . '\\ORM\\' . ucfirst($this->rename($driver->getDbName())); $parser->getSchemaReflex()->reflex($path, $namespace); $output->writeln('<notice>' . $bundle->getName() . '</notice>'); $output->writeln(' Reflex to ' . $path . '... <success>[OK]</success>'); return 0; } $bundles = $this->getContainer()->singleton('kernel')->getBundles(); foreach ($bundles as $bundle) { $output->writeln('<notice>' . $bundle->getName() . '</notice>'); $path = $bundle->getRootPath() . '/ORM/' . ucfirst($this->rename($driver->getDbName())); $namespace = $bundle->getNamespace() . '\\ORM\\' . ucfirst($this->rename($driver->getDbName())); $parser->getSchemaReflex()->reflex($path, $namespace); $output->writeln(' Reflex to ' . $path . '... <success>[OK]</success>'); } return 0; }
/** * @param Input $input * @param Output $output * @return int */ public function execute(Input $input, Output $output) { $connection = $input->getArgument('connection'); if (empty($connection)) { $connection = 'read'; } $bundle = $input->getOption('bundle'); $loader = new FixtureLoader($this->getDriver($connection)); $fixtures = $this->scanFixtures($bundle); foreach ($fixtures as $name => $fixture) { $fixture = new $fixture(); if ($fixture instanceof FixtureInterface) { $loader->registerFixture($fixture); $output->writeln(sprintf('Register "%s" schema. <success>[OK]</success>', $name)); } } $loader->runSchema(); }
/** * @param Input $input * @param Output $output * @return void */ public function execute(Input $input, Output $output) { try { $bundle = $input->getArgument('bundle'); } catch (\Exception $e) { $output->writeln('<error>Bundle name is empty or null. Please you try again.</error>'); exit; } if (empty($bundle)) { $output->writeln('<error>Bundle name is empty or null. Please you try again.</error>'); exit; } $bundle = str_replace(':', DIRECTORY_SEPARATOR, $bundle) . 'Bundle'; $bundle = implode(DIRECTORY_SEPARATOR, array_map(function ($v) { return ucfirst($v); }, explode(DIRECTORY_SEPARATOR, $bundle))); $source = $this->getContainer()->singleton('kernel')->getRootPath() . '/../src'; $this->builderStructure($source, $bundle, str_replace(DIRECTORY_SEPARATOR, '', $bundle)); $output->writeln('Building in ' . $source . ' <success>[OK]</success>'); }