Skip to content
This repository was archived by the owner on Nov 15, 2018. It is now read-only.
This repository was archived by the owner on Nov 15, 2018. It is now read-only.

[DX] Ease rounting generation by refering to routes by FQCN #75

@backbone87

Description

@backbone87

Insteadof $urlGenerator->generate('long_route_name_possibly_autogenerated', $params) maybe its possible to provide something like:

  • $urlGenerator->generate(MyAction::class, $params)
  • $urlGenerator[MyAction::class]($params)
  • $myAction->route($params)

Possible implementation strategies:

  • Decorate route loader to register 2 routes (one named with autogenerated name, one with FQCN as route name) for __invokeable controllers
  • Decorate UrlGenerator to generate route name from args that match a FQCN (if($classLoader->exists($routeName)) $routeName = $this->getDefaultRouteName($routeName);)
  • Keep a map in UrlGenerator to map route names (if($this->routeMap[$routeName]) $routeName = $this->routeMap[$routeName];)

WDYT?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions