Hello everyone!

We have been investing plenty of personal time and energy for many years to share our knowledge with you all. However, we now need your help to keep this blog running. All you have to do is just click one of the adverts on the site, otherwise it will sadly be taken down due to hosting etc. costs. Thank you.

You to make service container available in your data fixtures to access parameters or services so the example below shows you how to do it. For more info click here.

Example data fixtures

namespace Football\FrontendBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

class CountryFixtures extends AbstractFixture implements FixtureInterface, ContainerAwareInterface
private $container;

public function setContainer(ContainerInterface $container = null)
$this->container = $container;

public function load(ObjectManager $manager)