You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
671 B
PHTML
34 lines
671 B
PHTML
4 years ago
|
<?php
|
||
|
|
||
|
namespace App\DataFixtures;
|
||
|
|
||
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||
|
use Doctrine\Common\Persistence\ObjectManager;
|
||
|
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
||
|
|
||
|
|
||
|
|
||
|
class UserFixtures extends Fixture
|
||
|
{
|
||
|
|
||
|
private $passwordEncoder;
|
||
|
|
||
|
public function __construct(UserPasswordEncoderInterface $passwordEncoder)
|
||
|
{
|
||
|
$this->passwordEncoder = $passwordEncoder;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
public function load(ObjectManager $manager)
|
||
|
{
|
||
|
$user = new User();
|
||
|
$user->setPassword($this->passwordEncoder->encodePassword(
|
||
|
$user,
|
||
|
'the_new_password'
|
||
|
));
|
||
|
|
||
|
$manager->flush();
|
||
|
}
|
||
|
}
|