1
Ich beginne mit Symfony (3.4) und habe ein Problem mit der Ladevorrichtung.
Wenn ich php bin/console doctrine:fixtures:load
ausführen dann bekomme ich Nachricht:Symfony Doctrine kann keine zu ladenden Geräte finden
In LoadDataFixturesDoctrineCommand.php line 95: Could not find any fixture services to load.
Es ist mein Code:
~/src/AppBundle/DataFixtures/ORM/LoadUserData.php
namespace AppBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class LoadUserData implements FixtureInterface, ContainerAwareInterface {
private $container;
/**
* Load data fixtures with the passed EntityManager
*
* @param ObjectManager $manager
*/
public function load(ObjectManager $manager)
{
$user = new User();
$user->setLogin('admin');
$user->setEmail('[email protected]');
$encoder = $this->container->get('security.password_encoder');
$password = $encoder->encodePassword($user, '123qwe');
$user->setPassword($password);
$manager->persist();
$manager->flush();
}
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
}
~/app /config/services.yml
Danke.