Problem/Motivation

The RouteBuilderInterface has no docbloc and its method docblocks are inaccurate.

Proposed resolution

Add a docblock explaining what the interface does, and including some detail on what route rebuilding and "dumping" actually is.

User interface changes

None.

API changes

None.

Data model changes

None.

Original report by @chx

RouteBuilderInterface does not have a documentation block. It should.

CommentFileSizeAuthor
#35 interdiff-33-35.txt559 bytesAnonymous (not verified)
#35 routebuilderinterface-2533220-35.patch1.54 KBAnonymous (not verified)
#33 routebuilderinterface-2533220-33.patch1.54 KBAnonymous (not verified)
#33 interdiff-26-33.txt1.58 KBAnonymous (not verified)
#26 2533220-26.patch568 bytessnehi
#26 interdiff.txt544 bytessnehi
#22 2533220-22.diff884 bytesmirom
#19 2533220-19.patch696 bytesmirom
#14 rbidocs-14.patch462 bytessnehi
#14 interdiff.txt438 bytessnehi
rbidocs.patch459 byteschx

Comments

dawehner’s picture

+++ b/core/lib/Drupal/Core/Routing/RouteBuilderInterface.php
@@ -7,6 +7,11 @@
+/**
+ * Builds and possibly dumps the route information.
+ *
+ * @ingroup menu
+ */

What about adding a @see to the Route provider and MatcherDumperInterface

chx’s picture

I certainly can. But what about an @ingroup menu on those too instead?

dawehner’s picture

I like the @ingroup menu but the RouteBuilder <-> RouterProvider are sort of always together, they support each other.

Crell’s picture

Routes are deliberately not part of the menu system anymore, so I don't think @ingroup menu is correct. Do we have a routing @group? If not, we should. :-)

The dumper and matcher come as a matched set, but the RouteBuilder itself shouldn't need to be swapped out for a new matcher/dumper set (eg, a Mongo or Cassandra backend).

I would suggest a description here of just "Rebuilds compiled routing information", with an @ingroup of "routing".

Thanks chx for the catch.

chx’s picture

If you visit https://api.drupal.org/api/drupal/8 and click "Routing, page controllers, and menu entries" then you land on https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Menu%21me...

So while the name "menu" might not be super correct any more, routing is already under group menu.

We can start a routing group for sure but what would it contain that the above one does not?

dawehner’s picture

Can you somehow have nested groups?

chx’s picture

I do not think that feature is supported by the doxygen standard we copied or the api module or ... anything :)

dawehner’s picture

Well, then let's start with @ingroup menu, its the right thing to do now.

Crell’s picture

Then we should start a new @group for routing specifically. Whether we do that as part of this patch or file a follow-up to reorganize it in the next patch, I defer to the committers on. As long as the follow-up is actually filed I am OK either way.

jhodgdon’s picture

Status: Needs review » Needs work

We can now revive this... On another issue, Menu and Routing topics were split up. See
https://api.drupal.org/api/drupal/8

Use @ingroup routing now instead of @ingroup menu, which will add it to the new split Routing topic:

https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Routing!routing.a...

tim.plunkett’s picture

Issue tags: +rc eligible
jhodgdon’s picture

Issue summary: View changes
Issue tags: -rc eligible +Novice

OK. What we need is for someone to take the patch from above and change @ingroup menu to @ingroup routing. Good Novice task...

Updating issue summary to match the patch/title.

snehi’s picture

Assigned: Unassigned » snehi
snehi’s picture

Status: Needs work » Needs review
StatusFileSize
new438 bytes
new462 bytes
dawehner’s picture

Maybe an @see to MatcherDumperInterface and RouteProviderInterface could be helpful.

jhodgdon’s picture

Status: Needs review » Needs work

Sounds like a good idea. Note that in docs headers, when referring to a class include the full namespace.

snehi’s picture

Assigned: snehi » Unassigned

Little busy, Anyone else can pick up.

mirom’s picture

Assigned: Unassigned » mirom
mirom’s picture

StatusFileSize
new696 bytes

Added @see to MatcherDumperInterface and RouteProviderInterface.

mirom’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 19: 2533220-19.patch, failed testing.

mirom’s picture

Status: Needs work » Needs review
StatusFileSize
new884 bytes

Reexported patch

Crell’s picture

Status: Needs review » Reviewed & tested by the community

OK, let's do it.

cilefen’s picture

Title: RouteBuilderInterface has no doxygen » RouteBuilderInterface has no docblock
alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/lib/Drupal/Core/Routing/RouteBuilderInterface.php
@@ -7,6 +7,14 @@
+ * Builds and possibly dumps the route information.

Rebuilds the route info and dumps to dumper. is the documentation on the rebuild method - does that need adjusting too? Also I'd have thought some description about what building routes means would be appropriate - or pointing to some documentation that does this.

snehi’s picture

Status: Needs work » Needs review
StatusFileSize
new544 bytes
new568 bytes

Attaching patch as no activity for a longer time.

mirom’s picture

Assigned: mirom » Unassigned
jhodgdon’s picture

Status: Needs review » Needs work
Issue tags: -Novice

Hm. Neither of those interfaces gives me any indication of what "rebuilding" or "dumping" means, actually. So I think this needs some more work.

snehi’s picture

Assigned: Unassigned » snehi
snehi’s picture

Can you give hint what should be there.

jhodgdon’s picture

Issue summary: View changes

I really don't know what this interface, or the classes that implement it do. But the doc block in this patch just says:

+/*
+ * Rebuilds the route info and dumps to dumper.
+ *
+ * @see \Drupal\Core\Routing\MatcherDumperInterface
+ * @see \Drupal\Core\Routing\RouteProviderInterface
+ *
+ * @ingroup routing
+ */
 interface RouteBuilderInterface {

So it just says it "rebuilds" the route info and "dumps" it to the Dumper. I kind of know what "rebuilds" means, but it would help if the interface told me that. I don't know at all what "dumps" means, so it would be very helpful if it told me what that was.

All I have, instead, is two @see references. If I look at the docs for these two interfaces, all the extremely non-helpful information I get is:

a)

Extends the symfony matcher dumper interface with a addRoutes method.

b)

Extends the router provider interface

This tells me absolutely nothing about what "rebuilding" or "dumping" is. Not helpful at all. So... this either needs to link me to some docs that explain what these two terms are, or explain them. And since I personally do not know what they mean exactly, sorry, I cannot help you... but those two interfaces are extensions of Symfony interfaces, and although Symfony has nearly zero API docs in their docs header, they do have quite a bit on their project site, so you might be able to learn more there or find a link that could be put into an @see, something like:

@see http://symfony.com/whatever/whatever/whatever

or better yet, a paragraph something like:

See http://symfony.com/something and http://symfony.com/something_else for more information on the route rebuilding and dumping process.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Anonymous’s picture

Assigned: snehi » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.58 KB
new1.54 KB

While the Symfony reference is quite extensive, it doesn't really explain what a "MatcherDumper" is or how it works. Or at least, I couldn't find it.

Looking through the code, I think "dumping" is a somewhat strange name. Symfony uses it to auto-generate PHP code or Apache rules. We use it to fill in the router table. I don't know whether or not we use it for something else as well.

+++ b/core/lib/Drupal/Core/Routing/RouteBuilderInterface.php
@@ -7,6 +7,14 @@
+ * Rebuilds the route info and dumps to dumper.

This is not correct. The route info gets added to the dumper, which then can dump it.

-   * Rebuilds the route info and dumps to dumper if necessary.
+   * Rebuilds the route info and dumps to dumper, but only if necessary.

I found this to be somewhat ambiguous. Do we always rebuild the route info and only dump it when necessary? Actually no. The necessary part of that phrase refers to both the rebuilding and the dumping.

Attached is a first go at a patch. I wasn't sure whether or not this info should go on the interface, or specifically on the rebuild() method.
The information that our use case is filling the router table is on \Drupal\Core\Routing\MatcherDumper. I would think that is the right place to do so, but we might want to point at it?

jhodgdon’s picture

Status: Needs review » Needs work

Thanks! This looks really excellent.

Except for one line:

+++ b/core/lib/Drupal/Core/Routing/RouteBuilderInterface.php
@@ -13,7 +30,7 @@
+   * Rebuilds the route information and dumps it, but only if necessary.

In your comment that came with the patch, you said that the "only if necessary" phrase applied to the rebuild. So, this line still seems wrong/ambiguous? Maybe it should say "Rebuilds the route information if necessary, and dumps it."?

Anonymous’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new1.54 KB
new559 bytes

Re #34: I really struggled making that a one liner :). Thanks for the suggestion!

I filled out the template for the IS to be a bit more specific on the improvements we are making.

Attached is a new patch, fixing the feedback in #34.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me. Thanks for the research and patches!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 57a5e9a and pushed to 8.1.x and 8.2.x. Thanks!

  • alexpott committed 15b999d on 8.2.x
    Issue #2533220 by snehi, pjonckiere, mirom, chx, jhodgdon, dawehner:...

  • alexpott committed 57a5e9a on 8.1.x
    Issue #2533220 by snehi, pjonckiere, mirom, chx, jhodgdon, dawehner:...
dawehner’s picture

Yeah!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.