protected function execute(InputInterface $input, OutputInterface $output)
 {
     $collection = $this->repository->findAll();
     $routes = [];
     foreach ($collection as $item) {
         $route = $this->provider->getRouteByName($item->getId());
         $routes['dynamic_' . $item->getId()] = ['path' => $route->getPath(), 'defaults' => $route->getDefaults(), 'requirements' => $route->getRequirements()];
     }
     $dumper = new Dumper();
     $yaml = $dumper->dump($routes, 3);
     $kernel = $this->getContainer()->get('kernel');
     $path = $kernel->getRootDir() . '/config/dynamic_routing.yml';
     file_put_contents($path, $yaml);
     $output->write('Dumping done.', true);
 }
Пример #2
0
 public function getRoutesByNames($names, $parameters = [])
 {
     $collection = $this->repository->findAll();
     $routes = [];
     foreach ($collection as $item) {
         $routes[] = $this->getRouteByName($item->getId());
     }
     return $routes;
 }