Add routes for custom list actions
overrides SonataAdmin/Admin::configureRoutes() so that it is called automatically by Admin::buildRoutes().

@param RouteCollection $collection
546659
protected function configureRoutes(RouteCollection $collection)
    {
        $librinfo = $this->getConfigurationPool()->getContainer()->getParameter('blast');

        foreach ($this->getCurrentComposition() as $class) {
            if (isset($librinfo[$class][ListMapper::class]['add']['_actions'])) {
                $actions = $librinfo[$class][ListMapper::class]['add']['_actions'] ? $librinfo[$class][ListMapper::class]['add']['_actions'] : [];

                foreach ($actions['actions'] as $key => $action) {
                    if (!empty($action['route'])) {
                        $routeSuffix = $action['route'];
                    } else {
                        $routeSuffix = $key;
                    }
                    $collection->add($key, $this->getRouterIdParameter() . '/' . $routeSuffix);
                }
            }
        }
    }
433470
public static function configureRoutes(GroupInterface $routes): void
    {
        $routes->group('', function (GroupInterface $routes): void {

            $routes->addContainerConfigurators([
                L10nContainerConfigurator::CONFIGURATOR,
            ]);

            for ($i = 0; $i < 10 + 10 * 5; ++$i) {
                $routes->post("/posts$i/create", [PostsController::class, PostsController::METHOD_CREATE]);
            }

        });
    }
165961
protected function createRouteCollections(array $versions)
    {
        foreach ($versions as $version) {
            if (! isset($this->routes[$version])) {
                $this->routes[$version] = new RouteCollector($this->parser, clone $this->generator);
            }
        }
    }
762939
protected function configureRoutes(RouteCollectionBuilder $routes)
    {
        foreach ($this->routes as $route) {
            is_array($route)
                ? $routes->add(
                    $route[0],
                    $route[1],
                    $route[2]
                )
                : $routes->import($route);
        }
    }
225447
public function createRouteCollection()
    {
        $routeCollection  = $this->createNew(RouteCollection::class);

        $routeCollection->addRoute('GET', '/{resourceNamePlural}', [$this, 'callGetResources']);
        $routeCollection->addRoute('POST', '/{resourceNamePlural}', [$this, 'callCreateNewResource']);
        $routeCollection->addRoute('PUT', '/{resourceNamePlural}', [$this, 'callCreateNewResource']);
        $routeCollection->addRoute('HEAD', '/{resourceNamePlural}', [$this, 'callMethodNotAllowed']);
        $routeCollection->addRoute('DEL', '/{resourceNamePlural}', [$this, 'callMethodNotAllowed']);

        $routeCollection->addRoute('GET', '/{resourceNamePlural}/{id}', [$this, 'callGetResource']);
        $routeCollection->addRoute('POST', '/{resourceNamePlural}/{id}', [$this, 'callEditResource']);
        $routeCollection->addRoute('PUT', '/{resourceNamePlural}/{id}', [$this, 'callEditResource']);
        $routeCollection->addRoute('HEAD', '/{resourceNamePlural}/{id}', [$this, 'callResourceExists']);
        $routeCollection->addRoute('DEL', '/{resourceNamePlural}/{id}', [$this, 'calldDeleteResource']);

        $routeCollection->addRoute('GET', '/{resourceNamePlural}/{id}/{childNamePlural}', [$this, 'callGetChildResources']);
        $routeCollection->addRoute('POST', '/{resourceNamePlural}/{id}/{childNamePlural}', [$this, 'callCreateNewChildResource']);
        $routeCollection->addRoute('PUT', '/{resourceNamePlural}/{id}/{childNamePlural}', [$this, 'callCreateNewChildResource']);
        $routeCollection->addRoute('HEAD', '/{resourceNamePlural}/{id}/{childNamePlural}', [$this, 'callMethodNotAllowed']);
        $routeCollection->addRoute('DEL', '/{resourceNamePlural}/{id}/{childNamePlural}', [$this, 'callMethodNotAllowed']);

        return $routeCollection;
    }
290038
public function addManyToManyCollections($collections)
    {
        if (!is_array($collections)) {
            $collections = [$collections];
        }
        $this->manyToManyCollections = array_merge($this->manyToManyCollections, $collections);

        return $this;
    }
521879
public void setCollection(String collection) {
        addField(ConfigureNodeFields.collection, FormField.Type.text_single);
        setAnswer(ConfigureNodeFields.collection.getFieldName(), collection);
    }
500720
public function setTranslations(Collection $collection)
    {
        $this->translations = new ArrayCollection();

        foreach ($collection as $translation) {
            $this->addTranslation($translation);
        }
    }
495194
public function onPreHandleRequestWithCollection(Collection $collection) {
        $output = new ArrayCollection();
        foreach ($collection as $current) {
            $output->add($current);
        }
        return $output;
    }
73054
private function trackCollection(Collection $collection)
    {
        $blocks = $collection->getBlocks();
        $this->trackBlocks($collection, $blocks);
    }
1360813
public function registerRoutesCollection()
    {
        $this->app->singleton('routes.collection', function ($app) {
            return new RoutesCollection;
        });

        $this->app->alias('routes.collection', RoutesCollection::class);
    }
1297093
public function createCollectionTranslation(Collection $collection, string $locale): void
    {
        $query = $this->connection->createQueryBuilder()
            ->insert('ngbm_collection_translation')
            ->values(
                [
                    'collection_id' => ':collection_id',
                    'status' => ':status',
                    'locale' => ':locale',
                ]
            )
            ->setParameter('collection_id', $collection->id, Type::INTEGER)
            ->setParameter('status', $collection->status, Type::INTEGER)
            ->setParameter('locale', $locale, Type::STRING);

        $query->execute();
    }
261220
protected function hydrateComponents($collection)
    {
        $componentsLocated = array();

        foreach ($this->components as $model => $components) {
            foreach ($this->locators as $locator) {
                if ($locator->supports($model)) {
                    $locator->locate($model, $components);

                    foreach ($components as $key => $component) {
                        $componentsLocated[$key] = $component;
                    }

                    break;
                }
            }
        }

        foreach ($collection as $key => $action) {
            if ($action instanceof TimelineInterface) {
                $action = $action->getAction();
            }

            foreach ($action->getActionComponents() as $actionComponent) {
                $component = $actionComponent->getComponent();
                if (!$actionComponent->isText() && is_object($component) && null === $component->getData()) {
                    $hash = $component->getHash();

                    if (array_key_exists($hash, $componentsLocated) && !empty($componentsLocated[$hash]) && null !== $componentsLocated[$hash]->getData()) {
                        $actionComponent->setComponent($componentsLocated[$hash]);
                    } else {
                        if ($this->filterUnresolved) {
                            if ($collection instanceof PagerInterface) {
                                $items = iterator_to_array($collection->getIterator());
                                unset($items[$key]);
                                $collection->setItems($items);
                            } elseif (is_array($collection)) {
                                unset($collection[$key]);
                            } else {
                                throw new \Exception('Collection must be an array or a PagerInterface');
                            }
                            break;
                        }
                    }
                }
            }
        }

        return $collection;
    }
1000775
public function collectionAction($collection, Request $request = null)
    {
        $action = $this->container->get(CollectionPostArchiveAction::class);

        return $action($this->resolveRequest($request), $collection);
    }
764348
public function add($view, RuleCollection $collection)
    {
        $name = FormHelper::getFormName($view);
        if (isset($this->rules[$name])) {
            $this->rules[$name]->addCollection($collection);
        } else {
            $this->rules[$name] = $collection;
        }
    }
221483
protected function addRoutes(ControllerCollection $c)
    {
        $c->get('', 'overview')
            ->bind('extensions');

        // Allows BC with 3.2 and earlier, to be removed in 4.0
        $c->get('', 'overview')
            ->bind('extend');

        $c->get('/check', 'check')
            ->bind('check');

        $c->get('/depends', 'dependsPackage')
            ->bind('dependsPackage');

        $c->get('/prohibits', 'prohibitsPackage')
            ->bind('prohibitsPackage');

        $c->get('/dumpAutoload', 'dumpAutoload')
            ->bind('dumpAutoload');

        $c->get('/update', 'update')
            ->bind('update');

        $c->get('/install', 'install')
            ->bind('install');

        $c->get('/uninstall', 'uninstall')
            ->bind('uninstall');

        $c->get('/installed', 'installed')
            ->bind('installed');

        $c->get('/installAll', 'installAll')
            ->bind('installAll');

        $c->get('/installPackage', 'installPackage')
            ->bind('installPackage');

        $c->get('/installInfo', 'installInfo')
            ->bind('installInfo');

        $c->get('/packageInfo', 'packageInfo')
            ->bind('packageInfo');

        $c->get('/generateTheme', 'generateTheme')
            ->bind('generateTheme');
    }
298984
protected function localizeCollection(array $prefixes, RouteCollection $collection)
    {
        $removeRoutes = array();
        $newRoutes = new RouteCollection();
        foreach ($collection->all() as $name => $route) {
            $routeLocale = $route->getDefault(self::LOCALE_PARAM);
            if ($routeLocale !== null) {
                if (!isset($prefixes[$routeLocale])) {
                    throw new MissingRouteLocaleException(sprintf('Route `%s`: No prefix found for locale "%s".', $name, $routeLocale));
                }
                $route->setPath('/' . $prefixes[$routeLocale] . $route->getPath());
                continue;
            }
            // No locale found for the route so localize the route
            $removeRoutes[] = $name;
            foreach ($prefixes as $locale => $prefix) {
                /** @var \Symfony\Component\Routing\Route $localeRoute */
                $localeRoute = clone $route;
                $localeRoute->setPath('/' . $prefix . $route->getPath());
                $localeRoute->setDefault(self::LOCALE_PARAM, $locale);
                $newRoutes->add(
                    $this->routeNameInflector->inflect($name, $locale),
                    $localeRoute
                );
            }
        }
        $collection->remove($removeRoutes);
        $collection->addCollection($newRoutes);
    }