BazingaFakerBundle icon indicating copy to clipboard operation
BazingaFakerBundle copied to clipboard

The "faker.populator" service or alias has been removed

Open titiyoyo opened this issue 6 years ago • 4 comments

Hi,

I just tried to use this bundle in an sf4 project but I get the following error message after following documentation steps.

Am I doing something wrong?

 The "faker.populator" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.

Here is my config

# fconfig/packages/dev/bazinga_faker.yml
bazinga_faker:
    orm: doctrine
    entities:
        App\Entity\Business:
            number: 50

titiyoyo avatar Apr 18 '18 04:04 titiyoyo

poke @maxailloud

willdurand avatar Apr 18 '18 08:04 willdurand

Unfortunately in my project we don't use the faker bundle command, we use directly the Factory::create(). Don't ask me why we use it like this, I didn't work on it, but we do. I didn't try it yet but it might work for me as we don't use the command to generate our fake data, we just use the generator.

maxailloud avatar Apr 18 '18 08:04 maxailloud

I have the same problem. Is faker compatible with symfony 4 ?

klnjmm avatar Apr 24 '18 06:04 klnjmm

Services in Symfony 4 are no longer public by default. If you're looking for a quick and dirty fix, you can implement the process method from CompilerPassInterface into your src/Kernel.php and mark the faker.populator service as public.

class Kernel extends BaseKernel **implements CompilerPassInterface**

...

public function process(ContainerBuilder $container)
{
    $populator = $container->findDefinition('faker.populator');
    $populator->setPublic(true);
}

msurma avatar May 01 '18 13:05 msurma