Q:

"Undefined class Security" in Symfony2

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, 

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 }

A:

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

