Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Console] router:match and expression language's condition breaks when using request variable #16968

Copy link
Copy link
Closed
@ymarillet

Description

@ymarillet
Issue body actions

Hi there

Having a route defined like this

class MyController extends Controller
{
    /**
     * @Route(
     *     "/mycontroller/{type}",
     *     name="my_route",
     *     condition="service('myservice').isKnownType(request.get('type'))"
     * )
     */
    public function testAction($type)
    {
        //do something here
    }
}

Makes the router:match to go crazy because the Request object is unknown to the command line

app/console router:matches /mycontroller/supertype

[RuntimeException]
Unable to get a property on a non-object.

I believe that a request object should be created here. This is also a very simple example that could have a workaround, but this is not a discussion about that.

Note: the service function used in the expression language is an implementation of a custom expression language function, which is just returning a defined service
ya rly

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.