找不到要加载的夹具服务 [英] Could not find any fixture services to load

查看:74
本文介绍了找不到要加载的夹具服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题已经被问过多次了:

i know this question has been asked already multiple times:


  1. Symfony 3.4和Fixtures Bundle问题,捆绑版本3.0

  2. Symfony 3.4.0找不到要加载的设备服务

  3. Symfony主义找不到要加载的装置

  4. 找不到要加载的夹具服务-Symfony 3.2

  1. Symfony 3.4 and Fixtures Bundle issue with bundle version 3.0
  2. Symfony 3.4.0 Could not find any fixture services to load
  3. Symfony Doctrine can't find fixtures to load
  4. Could not find any fixture services to load - Symfony 3.2

以上所有内容均未帮助我。也就是说,这是我的配置:

None of the above actually helped me out. That said, this is my configuration:

Composer.json

Composer.json

"require": {
"php": ">=7.0",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
....
},
    "require-dev": {
        ....
        "doctrine/doctrine-fixtures-bundle": "^3.0",
}

我使用的是公司开发的Bundle,在上述版本的最后一个版本上都可以正常工作(最新测试和工作配置为PHP 5.6,Doctrine软件包^ 1.6,Doctrine orm ^ 2.5,fixture软件包^ 3.0)。

I'm using a company-developed Bundle which worked fine until the last version of the above (last tested and working configuration had PHP 5.6, Doctrine bundle ^1.6,doctrine orm ^2.5, fixture bundle ^3.0).

此捆绑软件在 VendorName / BundleName / DataFixtures / ORM 中有一些灯具,所有灯具都具有以下声明:

This bundle has some Fixture inside VendorName/BundleName/DataFixtures/ORM, all the fixtures have the following declaration:

Class MyFixture1 extends Fixture implements OrderedFixtureInterface,FixtureInterface, ContainerAwareInterface{
    ...
}

在此捆绑包中有一个services.yml文件, d:

Inside this bundle there's a services.yml file, loaded by this:

public function load(array $configs, ContainerBuilder $container)
{
    $configuration = new Configuration();
    $config = $this->processConfiguration($configuration, $configs);

    $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
    $loader->load('services.yml');
}

VendorName / BundleName / Resources / config / Services.yml我尝试了不同的配置:

VendorName/BundleName/Resources/config/Services.yml i tried different configurations:

services:
_defaults:
  autowire: true
  autoconfigure: true
  public: false

VendorName\BundleName\:
  resource: '../../*'
  # you can exclude directories or files but if a service is unused, it's removed anyway
  exclude: '../../{Entity,Repository,Tests,EventListener}'

我尝试在DataFixtures内部进行显式搜索:

I tried expliciting searching inside DataFixtures:

 VendorName/BundleName\DataFixtures\:
  resource: '../../src/VendorName/BundleName/DataFixtures'
  tags: ['doctrine.fixture.orm']

甚至手动配置服务:

VendorName\BundleName\DataFixtures\ORM\MyFixture1:
  class: VendorName/BundleNamee\DataFixtures\ORM\MyFixture1
  tags: ['doctrine.fixture.orm']

但不幸的是,它一直在提示错误。知道我在做什么错吗?很久以前,可以手动向Fixture命令指定要查找的捆绑软件,但现在已经不可能了

But unfortunately it keeps giving the error. Any idea of what i'm doing wrong? Long time ago it was possible to manually specify to the fixture command which bundle to look in, but now it's not possible anymore

UPDATE 1:
对不起,他们忘了指出错误消息:找不到要加载的夹具服务

UPDATE 1: Sorry guys forgot to point the error message: "Could not find any fixture services to load"

推荐答案

登陆到这里我解决了我的问题,我能告诉你的是:

For everyone landing here i solved my problem, what i can tell you is:


  1. 仔细检查您在AppKernel中启用了捆绑包

  2. 使用命令php bin /控制台缓存清除symfony缓存:clear --env = dev(或env = prod)

  3. 手动删除缓存文件夹

这篇关于找不到要加载的夹具服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆