Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. RouteCollection.php

function RouteCollection::addCollection

Adds a route collection at the end of the current set by appending all routes of the added collection.

File

vendor/symfony/routing/RouteCollection.php, line 169

Class

RouteCollection
A RouteCollection represents a set of Route instances.

Namespace

Symfony\Component\Routing

Code

public function addCollection(self $collection) : void {
    // we need to remove all routes with the same names first because just replacing them
    // would not place the new route at the end of the merged array
    foreach ($collection->all() as $name => $route) {
        unset($this->routes[$name], $this->priorities[$name], $this->aliases[$name]);
        $this->routes[$name] = $route;
        if (isset($collection->priorities[$name])) {
            $this->priorities[$name] = $collection->priorities[$name];
        }
    }
    foreach ($collection->getAliases() as $name => $alias) {
        unset($this->routes[$name], $this->priorities[$name], $this->aliases[$name]);
        $this->aliases[$name] = $alias;
    }
    foreach ($collection->getResources() as $resource) {
        $this->addResource($resource);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal