我正在学习Symfony 4.1.3。
我已经用作曲家创建了演示项目:
composer -V: Composer version 1.7.1 2018-08-07 09:39:23
我已经安装了orm-fixtures:
composer require orm-fixture
Using version ^3.0 for doctrine/doctrine-fixtures-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.1.*"
Nothing to install or update
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
然后我创建了夹具:
php bin/console make:fixtures
已创建文件src / DataFixtures / ArticleFixtures.php:
<?php
namespace App\DataFixtures;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Bundle\FixturesBundle\Fixture;
class ArticleFixtures extends Fixture
{
public function load(ObjectManager $manager)
{
// $product = new Product();
// $manager->persist($product);
$manager->flush();
}
}
然后use Doctrine\Bundle\FixturesBundle\Fixture;
行用红色下划线显示以下消息:
The import Doctrine\Bundle\FixturesBundle\Fixture cannot be resolved
我被这个错误困扰,我不知道该如何解决。 任何帮助将不胜感激。