Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Add getter to retrieve configured routes #421

Closed
weierophinney opened this issue Jan 10, 2017 · 6 comments
Closed

Add getter to retrieve configured routes #421

weierophinney opened this issue Jan 10, 2017 · 6 comments

Comments

@weierophinney
Copy link
Member

Per a comment detailing how to handle modules in the Expressive skeleton, we need to expose a getter to allow users/tooling to retrieve the routes. Since routes are already stored as a property of the Application instance, we can add the following:

/**
 * Retrieve the set of currently registered routes.
 *
 * @return Router\Route[]
 */
public function getRoutes()
{
    return $this->routes;
}
@Ocramius
Copy link
Member

-1 on this: make it a service instead?

@weierophinney
Copy link
Member Author

Routes are created and added when calling get(), post(), etc.; router implementations are not guaranteed to store the original instances. As such, the Application instance is the canonical location for storing them.

Knowing that, what would you recommend, @Ocramius ?

@Ocramius
Copy link
Member

Ocramius commented Jan 11, 2017 via email

@krzysiekpiasecki
Copy link

krzysiekpiasecki commented Jan 11, 2017

If I have understood the problem then "Visitor" ?

public function routes(RouteCollectorInterface $collector): RouteCollectorInterface;

@Ocramius
Copy link
Member

@krzysiekpiasecki overkill for this scenario - I was just hoping for simply not expanding the API on the Application object, at all.

weierophinney added a commit that referenced this issue Jan 26, 2017
Add getter to retrieve configured routes #421
weierophinney added a commit that referenced this issue Jan 26, 2017
@weierophinney
Copy link
Member Author

#426 resolves this and has been merged to the develop branch.

@weierophinney weierophinney modified the milestones: 1.1.0, 2.0.0 Jan 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants