找不到任何要加载的夹具服务 - Symfony 3.2

时间:2018-03-16 20:24:22

标签: php symfony doctrine-orm doctrine

运行 php bin / console doctrine:fixtures:load 命令后,我收到此错误消息。

  

20:41:01 ERROR [console]运行命令“doctrine:fixtures:load”时抛出错误。消息:“无法找到任何要加载的夹具服务。” [“错误”=> InvalidArgumentException {trace:{â||}},“c   ommand“=>”doctrine:fixtures:load“,”message“=>”找不到任何要加载的夹具服务。“] []   20:41:01 ERROR [console]命令“doctrine:fixtures:load”退出,代码为“1”[“command”=> “doctrine:fixtures:load”,“code”=> 1] []

[InvalidArgumentException] 无法找到任何要加载的灯具服务

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] [ - ]

我认为 services.yaml 配置有些不对,但我不知道是什么。我在 Symfony 3.2工作。有人可以帮助我消除这个错误吗?

代码是:

// calling redirects from your api will be problematic with react router
// allow your front end to decide what route to call based on the response 

app.post('/api/login', passport.authenticate('local), function(req, res, next) {
  if(req.user) {
      res.json(req.user)

  } else {
      //handle errors here, decide what you want to send back to your front end
      //so that it knows the user wasn't found
      res.statusCode = 503;
      res.send({message: 'Not Found'})
  }
});

services.yaml

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();
}
}

0 个答案:

没有答案