Skip to content

Router: Have a routes collection interface & support in Tracy router panel - #94

Open
Andrewsville wants to merge 4 commits into
nette:masterfrom
BianoCZ:route-lists-update
Open

Router: Have a routes collection interface & support in Tracy router panel#94
Andrewsville wants to merge 4 commits into
nette:masterfrom
BianoCZ:route-lists-update

Conversation

@Andrewsville

Copy link
Copy Markdown
  • Feature
  • Documentation – No change needed, unless you want to mention it in the "Custom Router" chapter.
  • BC break - no

Currently, the only way to have a collection of routes and have them displayed in the Tracy panel is to use the RouteList class.

This PR generalizes this logic to allow developers to implement their own route collections maybe with some logic inside (the RouteList is just a simple hashmap), maybe immutable (RouteList is mutable), etc. It comes from our use case but I believe it could be useful for others, too.

  • This PR introduces a new interface for route lists that extends IteratorAggregate (which is the easiest way to implement a Traversable) and adds the getModule() method that is required by the Tracy panel.
  • Because of the way RouteList is implemented, it can implement this new interface without any changes.
  • And the last change is the instanceof typecheck in the Panel to display a routes collection.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants