Symfony2 Circular reference in my routing.dev.yml

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:

http://symfony.com/doc/current/cookbook/security/form_login_setup.html.

When I add this the project still works:

firewalls:
        default:
            anonymous: ~
            http_basic: ~
            form_login:
                login_path: /login_user
                check_path: /login_check

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

<?php
// 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(
            'Frontend/navbar.html.twig',
            array(
                // 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 routing.dev.yml:

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

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

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

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

_main:
    resource: routing.yml

What can be the problem here?


Source: forms

Leave a Reply