当我添加新的灯具文件时
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
// get user fixtures
$user = $this->getReference(LoadUserData::USER_REFERENCE);
$userSecond = $this->getReference(LoadUserData::USER_TWO_REFERENCE);
$productFirst = Product::create($user, 'title1', 'title1', 'description3', null, null);
$manager->persist($productFirst);
$productSecond = Product::create($user, 'title2', 'title2', 'description2', null, null);
$manager->persist($productSecond);
$productThird = Product::create($userSecond, 'title3', 'title3', 'description3', null, null);
$manager->persist($productThird);
$manager->flush();
}
/**
* @return array
*/
public static function getGroups(): array
{
return ['demo', 'default'];
}
Run Code Online (Sandbox Code Playgroud)
我发现错误
清除数据库
加载 DataFixtures\LoadUserData
在 ReferenceRepository.php 第 154 行:
对“ROLE_USER”的引用不存在
类 LoadRoleData 有方法 getOrder(),但它不起作用。
public …Run Code Online (Sandbox Code Playgroud)