Symfony2 Circular reference in my

I am trying to build a login and registration forms and processes in my project, but I am getting the circular reference error for some reason. The registration works fine. The problem is when I am building a login form. I am using the tutorial from here:

When I add this the project still works:

            anonymous: ~
            http_basic: ~
                login_path: /login_user
                check_path: /login_check

But when I make the routes in the controller I get the error:

// src/AppBundle/Controller/SecurityController.php

// ...
use SymfonyComponentHttpFoundationRequest;
use SensioBundleFrameworkExtraBundleConfigurationRoute;

    class SecurityController extends Controller
         * @Route("/login_user", name="login_route")
        public function loginAction(Request $request)
             $authenticationUtils = $this->get('security.authentication_utils');

        // get the login error if there is one
        $error = $authenticationUtils->getLastAuthenticationError();

        // last username entered by the user
        $lastUsername = $authenticationUtils->getLastUsername();

        return $this->render(
                // last username entered by the user
                'last_username' => $lastUsername,
                'error'         => $error,

         * @Route("/login_check", name="login_check")
        public function loginCheckAction()
            // this controller will not be executed,
            // as the route is handled by the Security system

This is my

    resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
    prefix:   /_wdt

    resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
    prefix:   /_profiler

    resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
    prefix:   /_configurator

    resource: "@TwigBundle/Resources/config/routing/errors.xml"
    prefix:   /_error

    resource: routing.yml

What can be the problem here?

Source: forms

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.