Skip to content

[RFC] [DX] Re-usable Controller layout #23259

Closed
@scaytrase

Description

@scaytrase
Q A
Bug report? no
Feature request? no
BC Break report? no
RFC? yes
Symfony version 3.4 and\or 4.0

Hi, I'm currently working on some kind of RPC server bundle stack on top of symfony and I have a simple internal method routing, which generally repeats the symfony one's. I say repeats but not re-uses (which I hope to do initially), since the current routing have several limitations:

  • Controller Resolver signature requires the whole Request object, but really it uses only _controller attribute value, can we pass it instead? The Request object is used only to build Exception message with getPathInfo call, but I think we can overcome it with rethrow on higher level or just refactor it out. Most of the exceptions, thrown by ControllerResolver do not use the PathInfo to construct the message.

  • Controller Name Parser signature hardcodes the Controller\*Controller::*Action controler layout and it is even not configurable. Replacing this layout to another (or making this configurable) leads to full class override with copy&paste despite of the fact it is open for inheritance. we can make action guessing and action parsing to be protected methods, which define the layout

I also have some thoughts on decoupling Route from HTTP since most of the routing loading process could be fully reused for creating internal routing, but the current Route class is all about HTTP routing (i.e it modifies path to match URI format), but I haven't fully formalized this thoughts yet

I hope we can make the components a bit more decoupled with this ideas.

WDYT?

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXDX = Developer eXperience (anything that improves the experience of using Symfony)HttpKernel

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions