How to fetch entities in db while using doctrine fixtures?
<p>I have been the ContainerAwareInterface on my LoadAdvert class so I can call and use the EntityManager to retrieve users in the database.</p>

<p>However, when executing php bin/console doctrine:fixtures:load, the entity manager retrieves only an empty array, as if there was no user in the db.</p>

<pre><code>&lt;?php
// src/OC/PlatformBundle/DataFixtures/ORM/LoadCategory.php

namespace OC\PlatformBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use OC\PlatformBundle\Entity\Advert;
use OC\UserBundle\Entity\User;

   class LoadAdvert implements FixtureInterface, ContainerAwareInterface
    {
      /**
       * @var ContainerInterface
       */
      private $container;

      public function setContainer(ContainerInterface $container = null)
      {
        $this-&gt;container = $container;
      }

      // Dans l'argument de la méthode load, l'objet $manager est l'EntityManager
      public function load(ObjectManager $manager)
      {
        $em = $this-&gt;container-&gt;get('doctrine.orm.entity_manager');
        $author = $em-&gt;getRepository('OCUserBundle:User')-&gt;findAll();

        die(var_dump($author));
</code></pre>