From Gamboge Zebra, 10 Years ago, written in Plain Text.
Embed
  1. Design goals:
  2.  
  3. *) hooks instead of event subscribers
  4.  
  5. *) http kernel is out. The DrupalKernel no longer has anything to do with it.
  6.  
  7. *) symfony cmf routing is out. The only thing we use is the Route value object from Symfony. It's wired too deeply to remove. Copying it into the Drupal namespace, however is feasible.
  8.  
  9. *) what must be called and in a particular order is just called directly. Example: on router rebuild, AccessRouteSubscriber has a priority of -1000 and a comment hoping that fires after everything else. Sigh. We just fire it after calling the relevant alter hook.
  10.  
  11. *) paramconverters die instead we put the load information on rebuild into the parameters and call them directly. Loosely coupling is wonderful. Except when you must call it anyways and then it's (much) cheaper to call it directly. It took 1 line of code http://cgit.drupalcode.org/sandbox-chx-1857558/tree/core/lib/Drupal/Core/Entity/EntityResolverManager.php?h=kernelless#n180 to add this to the route.
  12.  
  13. *) a little less flexibility: the "page callback" can return a render array or a Response object and that's it. No more "hey return something a view subscriber will deal with it" silliness. This immediately resolves https://www.drupal.org/node/2327277 . That issue simply ceases to exist.
  14.  
  15. *) a little less flexibility: besides path, we will add method (GET, PUT etc), Accept (or perhaps the format Http Foundation mutates the Accept header into -- so json, hal_json etc), Content-Type (for POST) into the {router} table and then you can select on these four and that's about it. Still does REST but it's 1 quick SQL query returning the route to be used immediately. If you want to put two routes that only differ on X-My-Super-Header then put that into your "page controller". We do not cater to cover the universe. We cater to get maintainable and releasable code. Side note: https://www.drupal.org/node/2058845#comment-8454165 is invalid because it only takes path as a PK into consideration but D8 has far more routes.
  16.