Skip to content

[DX] Improve generation of absolute URLs #17413

Closed
@javiereguiluz

Description

@javiereguiluz

Problem

In Symfony 2.x this is how you generate an absolute URL:

$this->get('router')->generate('route_name', $routeParams, true);

This is how you do the same in Symfony 3.x:

use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

$this->get('router')->generate('route_name', $routeParams, UrlGeneratorInterface::ABSOLUTE_URL);

To me, the new version looks infinitely worse than the old one.

Solution

I guess Symfony Core won't accept bringing back the boolean argument, so we could add a new generateUrl() method:

$this->get('router')->generateUrl('route_name', $routeParams);

Thoughts? Better ideas? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions