Skip to content
Advertisement

Could not find any fixture services to load

i know this question has been asked already multiple times:

  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

"require": {
"php": ">=7.0",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
....
},
    "require-dev": {
        ....
        "doctrine/doctrine-fixtures-bundle": "^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).

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{
    ...
}

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 LoaderYamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
    $loader->load('services.yml');
}

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

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

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

I tried expliciting searching inside DataFixtures:

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

And even manually configure the service:

VendorNameBundleNameDataFixturesORMMyFixture1:
  class: VendorName/BundleNameeDataFixturesORMMyFixture1
  tags: ['doctrine.fixture.orm']

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: Sorry guys forgot to point the error message: “Could not find any fixture services to load”

Advertisement

Answer

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

  1. Double check you enabled the Bundle in the AppKernel
  2. Clear your symfony cache using the command php bin/console cache:clear –env=dev (or env=prod)
  3. Manually delete cache folder
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement