createRoute example

throw new \LogicException(sprintf('Route "%s" with locale "%s" is missing a corresponding prefix in its parent collection.', $name$locale));
                    }

                    $paths[$locale] = $prefixes[$locale].$localePath;
                }
            }
        } elseif (null !== $prefixes) {
            foreach ($prefixes as $locale => $prefix) {
                $paths[$locale] = $prefix.$path;
            }
        } else {
            $routes->add($namePrefix.$name$route = $this->createRoute($path));
            $collection->add($namePrefix.$name$route);

            return $routes;
        }

        foreach ($paths as $locale => $path) {
            $routes->add($name.'.'.$locale$route = $this->createRoute($path));
            $collection->add($namePrefix.$name.'.'.$locale$route);
            $route->setDefault('_locale', $locale);
            $route->setRequirement('_locale', preg_quote($locale));
            $route->setDefault('_canonical_route', $namePrefix.$name);
        }
if (\is_scalar($defaultValue = $param->getDefaultValue()) || null === $defaultValue) {
                        $defaults[$param->name] = $defaultValue;
                    } elseif ($defaultValue instanceof \BackedEnum) {
                        $defaults[$param->name] = $defaultValue->value;
                    }
                    break;
                }
            }
        }

        foreach ($paths as $locale => $path) {
            $route = $this->createRoute($path$defaults$requirements$options$host$schemes$methods$condition);
            $this->configureRoute($route$class$method$annot);
            if (0 !== $locale) {
                $route->setDefault('_locale', $locale);
                $route->setRequirement('_locale', preg_quote($locale));
                $route->setDefault('_canonical_route', $name);
                $collection->add($name.'.'.$locale$route$priority);
            } else {
                $collection->add($name$route$priority);
            }
        }
    }

    
throw new \LogicException(sprintf('Route "%s" with locale "%s" is missing a corresponding prefix in its parent collection.', $name$locale));
                    }

                    $paths[$locale] = $prefixes[$locale].$localePath;
                }
            }
        } elseif (null !== $prefixes) {
            foreach ($prefixes as $locale => $prefix) {
                $paths[$locale] = $prefix.$path;
            }
        } else {
            $routes->add($namePrefix.$name$route = $this->createRoute($path));
            $collection->add($namePrefix.$name$route);

            return $routes;
        }

        foreach ($paths as $locale => $path) {
            $routes->add($name.'.'.$locale$route = $this->createRoute($path));
            $collection->add($namePrefix.$name.'.'.$locale$route);
            $route->setDefault('_locale', $locale);
            $route->setRequirement('_locale', preg_quote($locale));
            $route->setDefault('_canonical_route', $namePrefix.$name);
        }
if (\is_scalar($defaultValue = $param->getDefaultValue()) || null === $defaultValue) {
                        $defaults[$param->name] = $defaultValue;
                    } elseif ($defaultValue instanceof \BackedEnum) {
                        $defaults[$param->name] = $defaultValue->value;
                    }
                    break;
                }
            }
        }

        foreach ($paths as $locale => $path) {
            $route = $this->createRoute($path$defaults$requirements$options$host$schemes$methods$condition);
            $this->configureRoute($route$class$method$annot);
            if (0 !== $locale) {
                $route->setDefault('_locale', $locale);
                $route->setRequirement('_locale', preg_quote($locale));
                $route->setDefault('_canonical_route', $name);
                $collection->add($name.'.'.$locale$route$priority);
            } else {
                $collection->add($name$route$priority);
            }
        }
    }

    
Home | Imprint | This part of the site doesn't use cookies.