for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\DataFixtures;
use App\Entity\User;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
class UsersFixtures extends Fixture
{
private $encoder;
public function __construct(UserPasswordEncoderInterface $encoder)
$this->encoder = $encoder;
}
public function load(ObjectManager $manager)
$user = new User();
$user->username = 'tester_fixture';
$user->email = '[email protected]';
$user->setPassword('123456', $this->encoder);
$manager->persist($user);
$manager->flush();