Answer the question
In order to leave comments, you need to log in
Routing in Symfony for bundle?
Hello! I understand Symfony 3.4, but I can't figure out how to add a route for the controller.
Added bundle to routing.yml
user:
resource: '@UserBundle/Controller/'
type: annotation
namespace UserBundle\Controller;
use FOS\UserBundle\Doctrine\UserManager;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\Encoder\EncoderFactory;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use UserBundle\Entity\User;
/**
* Class LoginController
*
* @package UserBundle\Controller
*
* @Route("/login", name="login_")
*/
class LoginController extends Controller
{
/**
* Matches / exactly
*
* @Route("/", name="login")
*/
public function index(Request $request)
{
return new Response(
'Welcome '
Response::HTTP_OK,
['Content-type' => 'application/json',]
);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question