Closed (duplicate)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
8 Nov 2012 at 19:06 UTC
Updated:
29 Jul 2014 at 21:29 UTC
Jump to comment: Most recent file
Comments
Comment #1
g.oechsler commentedHere is a first try. It's implementing a hand full of methods, satisfying a bunch of interfaces. But it's not really doing much.
I'm going to push the code to the wscci sandbox to a branch called 1835762-router.
Comment #3
Crell commented#1: 1835762_router.patch queued for re-testing.
Comment #5
g.oechsler commented#1: 1835762_router.patch queued for re-testing.
Comment #6
Crell commentedI'm not sure if we want to make this method actually work, or just make it fail hard as a note to not do that. Hm.
Ugh. Which interface demands this? We should probably throw an exception here, since our route collections will be too big to return.
Also related: https://github.com/symfony/symfony/pull/5895
Comment #7
g.oechsler commentedI disabled match() and getRouteCollection(), which is part of RouterInterface btw., by throwing an Exception. I added some info about that in the docs.
For now it looks like I'll have to wait for issues to resolve or pull request to be merged.
Comment #8
g.oechsler commentedThe Router now takes a generator in the constructor and passes generate() calls to it.
As there is still no generator I mocked one for testing, just like the MockMatcher.
Comment #9
Crell commentedNice.
I think we need to wire this into the DIC in this patch, which means having a noop Generator object that we can inject into it. So:
1) Create a UrlGeneratorInterface-compliant object that does nothing but throw exceptions if you try to use it.
2) Add a "router" service to the DIC that takes the current matcher and that new temp generator as dependencies.
3) Rewrite the DIC so that router object is what is passed to RouterListener, rather than passing the matcher directly.
4) Profit!
Comment #10
g.oechsler commentedI took care of the first three points and look forward to see the fourth happen!
Comment #11
Crell commentedOne change. This suggests we should be renaming matcher to router.matcher, for consistency with router.generator.
Once that's done, this is RTBC.
Comment #12
g.oechsler commentedRenamed matcher to router.matcher.
Comment #14
g.oechsler commentedWho would have guessed that renaming the router service is breaking the site. :P Registering the chained matchers to the renamed service now.
Comment #15
lars toomre commentedThis a bit puzzling... When should one use a '_' in a service name and when should one use a '.' separator? Is perhaps 'chained_matcher' mis-named?
Comment #16
g.oechsler commented'chained_matcher' is not a service! It is just a tag, an arbitrary (yet meaningful) string to mark a service for registration with an other service.
'router.matcher' is a service. It's the matcher service which is part of the router service. You will find other subsidiary services like 'router.generator' and 'router.builder' in CoreBundle. One might argue that services like 'nested_matcher' should be named 'router.nested_matcher'. This might be true or not, but it is surely out of scope of this issue.
Comment #17
lars toomre commentedThanks @g.oechsler for the explanation.
Comment #18
Crell commentedDomo arrigato, Mr. Testboto.
Comment #19
catchCan someone remind me why this is needed? It was my impression we could just subclass and override the one method that needed the generator but perhaps I'm mis-remembering. There's no explanation of why this is needed in the meta-issue either (except for the functional generator not being in yet, but that's not really a justification for committing a bunch of code that just throws exceptions when you try to use it).
Comment #20
g.oechsler commentedMy first implementation was just like this. It's absolutely possible to go without a generator.
On the other hand a router combines a matcher and a generator, passing the respective method calls to these objects. This is implemented and tested (see the MockGenerator in RouterUnitTest), so the Router is perfectly ready to operate with whatever generator comes along. While #1705488 - Implement a generator for Drupal paths is postponed, we need something to put into the router, just to satisfy the signature of the constructor.
Removing the noop generator unnecessarily cripples the router, which will possibly look exactly like this, once the full blown generator ships.
In short: It's not the router's fault that the generator issue is postponed.
Comment #21
catchOK let me put it a different way. What issue is this blocking that it can't wait on the generator patch and needs a dummy generator as a stop-gap?
Comment #22
Crell commentedWe will need to do this in order to remerge with the upstream Symfony CMF Routing component, which we want to do: https://github.com/symfony-cmf/Routing/pull/30. That is not ready for us to do yet, of course, but is on the roadmap.
As is, no, this issue doesn't add any new functionality yet, and nothing would be harmed in the near term by eliminating the dummy generator and inlining all of the "don't use this yet" exceptions. That's why this is only "normal". :-)
However, I don't see a problem with lining things up for when we can finally bring together the various moving parts here, now that the path issue landed. I am not really wild about the idea of adding a generator, adding a router, merging url() into the generator, moving all of the path alias caching over into generator, refactoring url_rewrite_outbound_alter(), adding HttpCache, and possibly refactoring our code around what happens in CMF Routing all in one go. (I think that's all of the bits and pieces involved in this line of work.) I'd rather build toward that incrementally, so more people can be involved.
If you really want to just sit on it and do the entirety of it at once, fine, say so explicitly. But I respectfully disagree, if for no other reason than it reduces the number of people who are logistically able to be involved in it. (Plus, it will probably be harder to do.)
Comment #23
Crell commentedThe all-at-once issue is here: #1874500: CMF-based Routing system
Closing this as a duplicate.