title: Symfony 3.4 and Fixtures Bundle
body: <p>I'm using symfony 3.4.1 with <code>doctrine/doctrine-fixtures-bundle": "2.4.1</code></p>
  
  <p>I'm trying to run fixtures, but I have this message when I'm trying to inject the <code>UserPasswordEncoderInterface</code> to encode my password.
  <a href="https://symfony.com/doc/master/bundles/DoctrineFixturesBundle/index.html#accessing-services-from-the-fixtures" rel="nofollow noreferrer">https://symfony.com/doc/master/bundles/DoctrineFixturesBundle/index.html#accessing-services-from-the-fixtures</a></p>
  
  <blockquote>
    <p>Fatal error: Uncaught
    Symfony\Component\Debug\Exception\FatalThrowableError: Type error: Too
    few arguments to function
    AppBundle\DataFixtures\DataFixtures::__construct(), 0 passed in
    /srv/api-platform/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Loader.php
    on line 210 and exactly 1 expected in
    /srv/api-platform/src/AppBundle/DataFixtures/ORM/DataFixtures.php:20
    Stack trace:</p>
    
    <h1>0 /srv/api-platform/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Loader.php(210):</h1>
    
    <p>AppBundle\DataFixtures\DataFixtures->__construct()</p>
    
    <h1>1 /srv/api-platform/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Loader.php(390):</h1>
    
    <p>Doctrine\Common\DataFixtures\Loader->createFixture('AppBundle\DataF...')</p>
    
    <h1>2 /srv/api-platform/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Loader.php(82):</h1>
    
    <p>Doctrine\Common\DataFixtures\Loader->loadFromIterator(Object(RecursiveIteratorIterator))</p>
    
    <h1>3 /srv/api-platform/vendor/doctrine/doctrine-fixtures-bundle/Command/LoadDataFixturesDoctrineCommand.php(102):</h1>
    
    <p>Doctrine\Commo in
    /srv/api-platform/src/AppBundle/DataFixtures/ORM/DataFixtures.php on
    line 20</p>
  </blockquote>
  
  <p>My Fixtures:</p>
  
  <pre><code>&lt;?php
  
  namespace AppBundle\DataFixtures;
  
  use AppBundle\Entity\TechnicalCenter;
  use AppBundle\Entity\User;
  use Doctrine\Bundle\FixturesBundle\Fixture;
  use Doctrine\Common\Persistence\ObjectManager;
  use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
  
  class DataFixtures extends Fixture
  {
      /** @var UserPasswordEncoderInterface $encoder */
      private $encoder;
  
      /**
       * DataFixtures constructor.
       * @param UserPasswordEncoderInterface $encoder
       */
      public function __construct(UserPasswordEncoderInterface $encoder)
      {
          $this-&gt;encoder = $encoder;
      }
  
      /**
       * Load data fixtures with the passed EntityManager
       *
       * @param ObjectManager $manager
       */
      public function load(ObjectManager $manager)
      {
          $technicalCenter = new TechnicalCenter();
          $technicalCenter-&gt;setName('Austerlitz');
          $manager-&gt;persist($technicalCenter);
  
          $admin = new User();
          $admin-&gt;setUsername('admin');
          $admin-&gt;setPassword($this-&gt;encoder-&gt;encodePassword($admin, 'admin'));
          $admin-&gt;setRoles(array('ROLE_ADMIN'));
          $admin-&gt;setTechnicalCenter($technicalCenter);
          $manager-&gt;persist($admin);
  
          $manager-&gt;flush();
      }
  }
  </code></pre>
  
  <p>My <code>security.yml</code></p>
  
  <pre><code>security:
      encoders:
          AppBundle\Entity\User: bcrypt
  </code></pre>