I follow topic to create dynamic routes. Examples i have a form, when user click submit form. new route will be created. It's working. But after clear cache by UI (or function drupal_flush_all_caches()). I want this auto but don't want use drupal_flush_all_caches() because it's very slow. So maybe i use other function to clear cache routing.


Use can use service router.builder with method rebuild(). Paste it's in function submit form:

| improve this answer | |
  • You should really inject the service into the class, and use $this->routerBuilder->setRebuildNeeded(); to prevent multiple rebuilds during the same request. – mpdonadio Sep 15 '16 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy