Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
titiyoyo opened this issue Apr 18, 2018 · 4 comments · May be fixed by #53
Open

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

titiyoyo opened this issue Apr 18, 2018 · 4 comments · May be fixed by #53

Comments

@titiyoyo
Copy link

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
@willdurand
Copy link
Owner

poke @maxailloud

@maxailloud
Copy link

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.

@klnjmm
Copy link

klnjmm commented Apr 24, 2018

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

@msurma
Copy link

msurma commented May 1, 2018

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);
}

@voronkovich voronkovich linked a pull request Jan 3, 2019 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants