user99999
user99999

Reputation: 2024

No route found from another bundle

I have added a second bundle and when I try to open some url from that bundle, I keep getting an error that the route was not found. Adding the same route to the main bundle works perfectly.

What's wrong?

enter image description here

This is my project structure. I also: - added the UserBundle to AppKernel.php (IDE shows the class exists) - use AppBundle\Controller namespace in AppBundle, and UserBundle\Controller namespace in UserBundle

The controller I try to access from the UserBundle looks like this:

namespace UserBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\SecurityContext;

class SecurityController extends Controller
{
    /**
     * @Route("/login", name="user_login")
     */
    public function loginAction(Request $request)
    {
       return array();
    }
}

Upvotes: 2

Views: 108

Answers (1)

tftd
tftd

Reputation: 17062

I suspect you need to add the UserBundle to your routing.yml configuration. You should have something like this in the routing.yml:

user_bundle:
    resource: "@UserBundle/Controller/"
    type:     annotation

Upvotes: 2

Related Questions