0

I have created a simple login system with Symfony2. I have followed the instruction given in --

http://symfony.com/doc/current/book/security.html#using-a-traditional-login-form

I have created everything told in the tutorial.

This is my error, I am getting -

Attempted to load class "Security" from namespace "Symfony\Component\Security\Core" in C:/XAMPP/xamppfiles/htdocs/symfony/src/Custom/TestBundle/Controller/SecurityController.php line 15. Do you need to "use" it from another namespace? Perhaps you need to add a use statement for one of the following: Sensio\Bundle\FrameworkExtraBundle\Configuration\Security.

I am using PHPStorm. Even my IDE is showing like,

enter image description here

My security.yml is look like --

security:
    encoders:
      Symfony\Component\Security\Core\User\User: plaintext
    role_hierarchy:
      ROLE_ADMIN: [ROLE_USER]
    providers:
      chain_provider:
        chain:
          providers: [in_memory]
      in_memory:
        memory:
          users:
            admin: {password: pass, roles: ROLE_ADMIN}
    firewalls:
      main:
        pattern: /.*
        form_login:
          login_path: /login
          check_path: /login_check
          default_target_path: /
        logout:
          path: /logout
          target: /
        security: true
        anonymous: true


    access_control:
      - { path: /login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
      - { path: /.*, roles: IS_AUTHENTICATED_ANONYMOUSLY }

1 Answer 1

1

You need to check version of your Symfony2 application and version of documentation

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.