Could not find any fixture services to load - Symf

2019-08-23 16:47发布

问题:

After I run php bin/console doctrine:fixtures:load command I got this error message.

20:41:01 ERROR [console] Error thrown while running command "doctrine:fixtures:load". Message: "Could not find any fixture services to load." ["error" => InvalidArgumentException {trace: { …} …},"c ommand" => "doctrine:fixtures:load","message" => "Could not find any fixture services to load."] [] 20:41:01 ERROR [console] Command "doctrine:fixtures:load" exited with code "1" ["command" => "doctrine:fixtures:load","code" => 1] []

[InvalidArgumentException] Could not find any fixture services to load

doctrine:fixtures:load [--append] [--em EM] [--shard SHARD] [--purge-with-truncate] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [ --no-debug] [--]

I suppose that is somethig wrong with services.yaml configuration but I don't know what. I work in Symfony 3.2. Can anybody help me to eliminate this mistake?

Code is:

namespace AppBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use AppBundle\Entity\Wallpaper;

class LoadWallpaperData implements FixtureInterface
{
public function load(ObjectManager $manager)
{
$wallpaper = (new Wallpaper())
    ->setFilename('abstract-background-pink.jpg')
    ->setSlug('abstract-background-pink')
    ->setWidth(1920)
    ->setHeight(1080)
;

$manager->persist($wallpaper);
$manager->flush();
}
}

services.yaml

parameters:
#parameter_name: value
 services:

#service_name:
#    class: AppBundle\Directory\ClassName
#    arguments: ['@another_service_name', 'plain_value', '%parameter_name%']
app.command.wallpaper_setup:
class: AppBundle\Command\SetupWallpapersCommand
arguments:

  - "%kernel.root_dir%"
  - "@doctrine.orm.default_entity_manager"

tags:

  - { name: console.command }