I am reading security in symfony2 documnet. But I was kind of confused
in using database instead of in memory security setting.
In config.yml, I set this one:

security.config:
    providers:
        main:
            entity: { class: HelloBundle:AuthUser, property:
username }

And then I set entity class like this:

class AuthUser implements AccountInterface{

     /**
     * @orm:Id
     * @orm:Column(type="integer")
     * @orm:GeneratedValue(strategy="IDENTITY")
     */

      protected $id;
     /**
     * @orm:Column(type="string", length="255")
     */
      protected $username;

      /**
      * @orm:Column(type="string", length="255")
      */
      protected $password;

      public function getUsername(){return $this->username;}
      public function setUsername($username){ $this->username=
$username; }

      public function getPassword(){return $this->password;}
      public function setPasswordd($password){$this->password=
$password;}


    public function loadUserByUsername($username)
    {   return $this->findOneBy(array('username' => $username));
    }

After this, I was lost. I always got error like this:

Catchable Fatal Error: Argument 3 passed to Symfony\Component\Security
\Authentication\Token\UsernamePasswordToken::__construct() must be an
array, null given, called in D:\webSite\sf2.0\src\vendor\symfony\src
\Symfony\Component\Security\Authentication\Provider
\UserAuthenticationProvider.php line 74 and defined in D:\webSite
\sf2.0\src\vendor\symfony\src\Symfony\Component\Security\Authentication
\Token\UsernamePasswordToken.php line 24

The document is not clear enough for instructing us how to use
database instead of inmemory user provider. If you have successfully
realized this, can you please show me how you did?

Thank in advance.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to