bourax webmaster
bourax webmaster

Reputation: 733

path to a page in another bundle

I have 2 bundles : Login and Redirect: in the index page of Login bundle i want to make a link to a page in the Redirect bundle, I am new in symfony and I had a routes problem: Here are my 2 routes files :

login_login_homepage:
pattern:  /login
defaults: { _controller: LoginLoginBundle:Default:index }

login_login_signup:
pattern:  /signup
defaults: { _controller: LoginLoginBundle:Default:signup }

login_login_logout:
pattern:  /logout
defaults: { _controller: LoginLoginBundle:Default:logout }
login_login_home:
pattern:  /home
defaults: { _controller: LoginLoginBundle:Default:home }

2nd:
gs_redirect_crud:
resource: "@GSRedirectBundle/Resources/config/routing/redirect.yml"
prefix:   /

what I made in the twig file

 <a href="{{path('gs_redirect_crud')}}" >Add New Redirection</a> 

but i had this error :

An exception has been thrown during the rendering of a template ("Route "gs_redirect_crud" does not exist.") in LoginLoginBundle:Default:welcome.html.twig at line 11. 

any help guys ???????

Upvotes: 0

Views: 1428

Answers (2)

szecsikecso
szecsikecso

Reputation: 301

You can set gs_redirect_crud as a global route.

Code to symfony-application / app / config / config.yml:

framework:
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
    validation:      { enable_annotations: true }

Code to symfony-application / app / config / routing.yml:

1st option:

gs_redirect_crud:
resource: "@GSRedirectBundle/Resources/config/routing/redirect.yml"
prefix:   /

2nd option:

gs_redirect_crud:
resource: "@GSRedirectBundle/Controller/"
type: annotation
prefix:   /

Upvotes: 0

fperet
fperet

Reputation: 456

It's obviously true, because there's no defined

"gs_redirect_crud"

route.

2nd instruction includes set of route definitions described in

@GSRedirectBundle/Resources/config/routing/redirect.yml 

file. Try to find correct route names in that file.

Upvotes: 1

Related Questions