Symfony\Component\Routing\RouteCollection::setParent PHP Method

setParent() private method

Sets the parent RouteCollection. It's only used internally from one RouteCollection to another. It makes no sense to be available as part of the public API.
private setParent ( RouteCollection $parent )
$parent RouteCollection The parent RouteCollection
    private function setParent(RouteCollection $parent)
    {
        $this->parent = $parent;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Adds a route collection to the current set of routes (at the end of the current set).
  *
  * @param RouteCollection $collection A RouteCollection instance
  * @param string          $prefix     An optional prefix to add before each pattern of the route collection
  *
  * @api
  */
 public function addCollection(RouteCollection $collection, $prefix = '')
 {
     $collection->setParent($this);
     $collection->addPrefix($prefix);
     // remove all routes with the same name in all existing collections
     foreach (array_keys($collection->all()) as $name) {
         $this->remove($name);
     }
     $this->routes[] = $collection;
 }