title: pass entityManager to EntityType class
body: <p>Using Symfony 3.2, I would pass entityManager object to EntityType class through constructor.</p>
  
  <p>I found that it can been done using services, as my configuration below:</p>
  
  <p>config.yml</p>
  
  <blockquote>
  <pre><code>imports:
      - { resource: parameters.yml }
      - { resource: security.yml }
      - { resource: services.yml }
      - { resource: "@mybundle/Resources/config/services.yml" }
  </code></pre>
  </blockquote>
  
  <p>services.yml</p>
  
  <blockquote>
  <pre><code>services:
      mybundle.profile_key:
          class: App\Bundle\mybundle\Form\ProfileKeyType
          arguments: ["@doctrine.orm.entity_manager"]
  </code></pre>
  </blockquote>
  
  <p>My EntityType:</p>
  
  <pre><code>namespace App\Bundle\mybundle\Form;
  
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  use Symfony\Component\OptionsResolver\OptionsResolver;
  use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  use Symfony\Component\Form\Extension\Core\Type\TextType;
  use Symfony\Component\Form\Extension\Core\Type\CollectionType;
  use Doctrine\ORM\EntityManager;
  
  class ProfileKeyType extends AbstractType
  {
  
      private $em;
      public function __construct(EntityManager $em) {
          $this-&gt;em = $em;
      }
  
      /**
       * {@inheritdoc}
       */
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
  
          $builder-&gt;add('key', TextType::class, array(
                  "label" =&gt; "Chiave identificativa"
          ))-&gt;add('visible', CheckboxType::class, array(
                  'label' =&gt; "Default visible",
                  "label_attr" =&gt; array( 'title' =&gt; 'Imposta la visibilit&amp;agrave; di default di questa chiave' ),
                  'required' =&gt; true
          ))-&gt;add('entity', CollectionType::class, array(
                  "data_class" =&gt; Entity::class
          ))-&gt;add('property')-&gt;add('type');
      }
  
      /**
       * {@inheritdoc}
       */
      public function configureOptions(OptionsResolver $resolver)
      {
          $resolver-&gt;setDefaults(array(
              'data_class' =&gt; 'App\Bundle\mybundle\Entity\ProfileKey'
          ));
      }
  
      /**
       * {@inheritdoc}
       */
      public function getBlockPrefix()
      {
          return 'app_bundle_mybundle_profilekey';
      }
  
  
  }
  </code></pre>
  
  <p>When I lauch my insert page, I get this error:</p>
  
  <pre><code>Type error: Argument 1 passed to App\Bundle\myBundle\Form\ProfileKeyType::__construct() must be an instance of Doctrine\ORM\EntityManager, none given, called in D:\eclipse_neon_workspace\iSerPa\vendor\symfony\symfony\src\Symfony\Component\Form\FormRegistry.php on line 85
  </code></pre>
  
  <p>What's wrong??</p>
  
  <p>Thx in advance</p>