iamjc015
iamjc015

Reputation: 2237

Imported route from a bundle not working in symfony

I'm a newbie in symfony.

So I created a bundle with namespace of Shinobi/UserBundle

In this bundle i have a routing configuration like so:

shinobi_user:
    resource: "@ShinobiUserBundle/Controller"
    type:     annotation

and inside app/config/routing.yml i wrote the following like so:

shinobi_user:
    resource: "@ShinobiUserBundle/Resources/config/routing.yml"
    prefix:   /

app:
    resource: "@AppBundle/Controller/"
    type:     annotation

when i tried to go to to this url

http://www.pilipinas.local/app_dev.php/default/

it says

No route found for "GET /default/

This is my Controller inside ShinobiUserBundle:

 /**
 * @Route("/default")
 */
class DefaultController extends Controller
{
    /**
     *  @Route("/", name="user")
     */
    public function indexAction()
    {
        return $this->render('ShinobiUIBundle:Default:index.html.twig');
    }
}

What am i doing wrong?

Thanks!

Upvotes: 1

Views: 613

Answers (1)

Mert Öksüz
Mert Öksüz

Reputation: 1071

You can't give route to your entire controller like that. That is wrong.

Delete

/** * @Route("/default") */

This part from controller and delete

shinobi_user:
resource: "@ShinobiUserBundle/Resources/config/routing.yml"
prefix:   /

this part from routing.yml then call

http://www.pilipinas.local/app_dev.php/

you'll see your user named url i mean this part;

/**
 *  @Route("/", name="user")
 */
public function indexAction()
{
    return $this->render('ShinobiUIBundle:Default:index.html.twig');
}

Upvotes: 1

Related Questions