1
Symfony (3.4)부터 시작하여로드 고정물에 문제가 있습니다. 내가 php bin/console doctrine:fixtures:load
을 실행하면
그럼 내가받을 메시지 :Symfony Doctrine이로드 할 Fixture를 찾을 수 없습니다.
~/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;
}
}
~/응용 프로그램 : 내 코드
In LoadDataFixturesDoctrineCommand.php line 95: Could not find any fixture services to load.
있다 /config/services.yml
parameters:
services:
_defaults:
autowire: true
autoconfigure: true
public: false
AppBundle\:
resource: '../../src/AppBundle/*'
exclude: '../../src/AppBundle/{Entity,Repository,Tests}'
AppBundle\Controller\:
resource: '../../src/AppBundle/Controller'
public: true
tags: ['controller.service_arguments']
감사합니다.