title: How to properly inject container to a form file without breaking the CRUD related actions?
body: <p>Currently, this is how I injected container into my form (by making it a service):</p>
  
  <p>ApFloorType.php
      
  
  <pre><code>namespace Techforge\ApartmentBundle\Form;
  
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilder;
  use Symfony\Component\DependencyInjection\ContainerInterface;
  
  
  class ApFloorType extends AbstractType
  {
  
      //in the controller, they are differently initialised
      private $container;
  
      public function __construct(ContainerInterface $container)
      {
          $this-&gt;container = $container;
      }
  
  
      public function buildForm(FormBuilder $builder, array $options)
      {
  
          $bath_choices = $this-&gt;container-&gt;getParameter('bath_choices');
          $bed_choices = $this-&gt;container-&gt;getParameter('bed_choices');
  
          $builder
              -&gt;add('baths', 'choice', array('choices' =&gt; $bath_choices))
              -&gt;add('beds', 'choice', array('choices' =&gt; $bed_choices))
              -&gt;add('name')
              -&gt;add('file')
              -&gt;add('plan_description', 'textarea')
              -&gt;add('min_max_feet', 'text')
              -&gt;add('deposit', 'text')
              -&gt;add('application_fee')
              -&gt;add('rental_deposit')
              -&gt;add('lease_terms', 'textarea')
              -&gt;add('threshhold_value')
              -&gt;add('auto_accept')
              -&gt;add('pending')
              -&gt;add('apartment', 'hidden', array('property_path' =&gt; false))
              -&gt;add('pre_post_update', 'hidden')
              -&gt;add('photos', 'collection', array('type' =&gt; new ApFloorImageType()))
  
          ;
      }
  
      public function getName()
      {
          return 'techforge_apartmentbundle_apfloortype';
      }
  }
  </code></pre>
  
  <p>The problem is that the ApFloor CRUD system stoped working after this because, in my controller, I couldn't just write </p>
  
  <pre><code>$form   = $this-&gt;createForm(new ApFloorType(), $floor);
  </code></pre>
  
  <p>This would produce the following error:</p>
  
  <blockquote>
    <p>Catchable Fatal Error: Argument 1 passed to
    Techforge\ApartmentBundle\Form\ApFloorType::__construct() must
    implement interface
    Symfony\Component\DependencyInjection\ContainerInterface, none given,
    called in
    /home/stormlifter/webapps/pmr/src/Techforge/ApartmentBundle/Controller/Manager/ApFloorController.php
    on line 38 and defined in
    /home/stormlifter/webapps/pmr/src/Techforge/ApartmentBundle/Form/ApFloorType.php
    line 16</p>
  </blockquote>
  
  <p>I solved this by calling form create method like this;</p>
  
  <pre><code>$form   = $this-&gt;createForm($this-&gt;get('apfloortype'), $floor);
  </code></pre>
  
  <p>So my question is, is there a workaround this so I don't have to change each createForm() call in my CRUD controller after making it a service?</p>