BazingaFakerBundle
BazingaFakerBundle copied to clipboard
The "faker.populator" service or alias has been removed
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
poke @maxailloud
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.
I have the same problem. Is faker compatible with symfony 4 ?
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);
}