Hello.

I'm writing some fixtures to load test users into db while testing. And to 
set password on the user I need to get required encoder from factory. And to 
get encoder factory I need, as I understand, to query Service container. How 
to do that from the fixture?

Fixture doesn't have any get() method to access service container so I 
cannot do this:
            $user = new User();
            $user->setEmail('[email protected]');
            $user->setPassword('password{AAAAA}');
            $user->setSalt('AAAAA');

            $factory = $user->get('security.encoder_factory');
            $encoder = $factory->getEncoder($user);
            $password = $encoder->encodePassword('ryanpass', 
$user->getSalt());
            $user->setPassword($password);

            $manager->persist($user);
            $manager->flush();

Is there another way to get service container?
Thanks.

-- 
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 developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to