private function _buildRouteStruct(NestedRoute $nestedRoute, $data = array(), &$structs = array()) { $definition = $this->getDefinition($nestedRoute->getNestedType()); foreach ($definition['functions'] as $function) { call_user_func_array(array($this, 'b' . $function), array($nestedRoute, &$data)); } $struct = array_merge_recursive($data, array('class' => $definition['flatten'], 'enabled' => $nestedRoute->isEnabled(), 'slug' => $nestedRoute->getId(), 'children' => array())); foreach ($nestedRoute->getChildren() as $nestedChild) { $struct['children'][] = $this->_buildRouteStruct($nestedChild, $data, $structs); } $class = $struct["class"]; if ($nestedRoute->getNestedType() == 'NestedEntityRoute') { $flattenRoute = new $class($this->router, $this->flattenRouteManager, $this->em, $struct); } else { $flattenRoute = new $class($this->router, $this->flattenRouteManager, $struct); } $struct["flatten_route"] = $flattenRoute; $structs[$struct["id"]] = $struct; return $struct["id"]; }