Closed welenlin closed 7 years ago
well, what do you mean by "is not working" ? What is the error you get ?
@stof when i try to var_dump("test");exit; in the setContainer , it doesnt trigger the var_dump so i'm assuming that it doesnt call the setContainer function method, and in the load() method i tried to use $this->container->get('session'); it triggers "fatal error: Call to a member function get() on null"
@welenlin that needs an example on how to reproduce the issue: the fixture loader on its own doesn't do the injection on its own, that's done by symfony-specific details while running the CLI command.
@Ocramius did you mean that i should run doctrine:fixtures:load in order to inject the container ?
@welenlin yes: the functionality provided by the raw doctrine/data-fixtures has no container awareness.
@Ocramius is there any other way than running the command ? since i'm using it in integration test case with the setup loadFixturesFromDirectory and i need to access the container there
As I already said, this package does know nothing about the container: it is a purely symfony-bundle-specific feature.
@welenlin the magic is done by the DataFixtures bridge within Symfony, namely Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader
.
@Ocramius @alcaeus
Okay I understand now, thanks for the help :)
Hello, I already try to inject container based on the documentation here and still not working, is there something wrong with my code or the DI itself is not working ?
doctrine fixture version: "doctrine/doctrine-fixtures-bundle": "2.2.*", symfony version : 2.8.7
Thanks :)