passwordEncoder = $passwordEncoder; } public function load(ObjectManager $manager) { $userAdmin = new User(); $userAdmin->setUsername('admin'); $this->setPassword($userAdmin, '123456789'); $userAdmin->setApiToken('ItsHammerTime!'); $manager->persist($userAdmin); $userDude = new User(); $userDude->setUsername('dude'); $this->setPassword($userDude, '1234'); $userDude->setApiToken('ItsDuderzeit!'); $manager->persist($userDude); $manager->flush(); $this->addReference(self::ADMIN_USER_REFERENCE, $userAdmin); $this->addReference(self::DUDE_USER_REFERENCE, $userDude); } private function setPassword(User& $user, string $plainPassword): void { $user->setPassword($this->passwordEncoder->encodePassword($user, $plainPassword)); } }