Symfony Frontend Url bundle - Provides helpers to easily generate URLs for frontend routes from within an admin environment.

Installs: 4 151

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 5

Forks: 2

Open Issues: 0


v1.0.0 2015-08-09 09:03 UTC

This package is not auto-updated.

Last update: 2021-09-18 00:22:19 UTC


Provides helpers to generate frontend URLs. Your Entities need these methods in order for this bundle to work:

    public function getRouteName()
        return 'genj_article_article_show';

    public function getRouteParameters()
        return array(
            'categoryType' => $this->getCategory()->getType(),
            'categorySlug' => $this->getCategory()->getSlug(),
            'slug'         => $this->getSlug()


You must set the name of your frontend environment in config.yml:

    frontend_environment: my_frontend_app


Front-end URL generation

From twig:

{{ object|genj_url_for_frontend }}

From PHP:

$urlGenerator = $this->container->get('genj_url_generator.routing.frontend.generator.url_generator');
$frontendUrl  = $urlGenerator->generateFrontendUrlForObject($object);

Preview parameter

It is possible to generate a URL to a 'preview controller'. You could e.g. restrict access to that controller and show non-cached versions of certain pages. If you do:

$frontendUrl  = $urlGenerator->generateFrontendUrlForObject($object, true);

Then the resulting URL would become /preview.php/path/to/page.

You can use the same thing from Twig too:

{{ object|genj_url_for_frontend(true) }}

More about environments: