Skip to content

ODM Fixture service not found? #328

@shehi

Description

@shehi

service:

<?php

namespace App\Resources\DataFixtures\MongoDB;

use App\Domain\Document\User;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Faker\Factory;
use Faker\ORM\Doctrine\Populator;
use FoundersLane\UserBundle\Database\Contract\Activatable;

class UserDataLoader extends AbstractFixture implements OrderedFixtureInterface
{
    public function load(ObjectManager $manager): void
    {
        // stuff here
    }
}

service registration is as such:

services:
    # ... all other stuff here, including autowiring = true
    App\Resources\DataFixtures\MongoDB\:
        resource: '%kernel.project_dir%/src/Resources/DataFixtures/MongoDB'
        tags: ['doctrine.fixture.odm']

./bin/console debug:autowiring --all -- Fixture:

Autowirable Types
=================

 The following classes & interfaces can be used as type-hints when autowiring:
 (only showing classes/interfaces matching Fixture)
 
 App\Resources\DataFixtures\MongoDB\UserDataLoader
 
 Load data fixtures from bundles.
 Doctrine\Bundle\MongoDBBundle\Command\LoadDataFixturesDoctrineODMCommand
 
 FoundersLane\UserBundle\DataFixtures\Processor\UserProcessor

 Pro-tip: use interfaces in your type-hints instead of classes to benefit from the dependency inversion principle.

YET, ./bin/console doctrine:mongodb:fixtures:load -n -vvv tells me:
[ERROR] Could not find any fixture services to load.
What am I doing wrong? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions