title: Symfony2 form type class not found
body: <p>I get this error:</p>
  
  <pre><code>Fatal error: Class 'DBP\InterfazIcedbpBundle\Form\Type\PreferencesIcecatType' not found in C:\xampp\htdocs\InterfaceICEDBP\src\DBP\InterfazIcedbpBundle\Controller\PreferencesIcecatController.php on line 66
  </code></pre>
  
  <p>I am trying to create e form clase so it is reusable and i have followed <a href="http://symfony.com/doc/current/book/forms.html#book-form-creating-form-classes" rel="nofollow">the manual</a>.</p>
  
  <p>I am using symfony 2.3.4, in Windows with XAMPP</p>
  
  <p>I've already tried to clear the cache in both enviroments, restart apache and MariaDB, Do you have any clue? Thank you very much!</p>
  
  <p>I have done other type for other form I have and it works perfectly, so i think is something wrong in some where but not related with namespaces.</p>
  
  <p>This is my Controller, it is in the folder \src\DBP\InterfazIcedbpBundle\Controller</p>
  
  <pre><code>namespace DBP\InterfazIcedbpBundle\Controller;
  
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  use DBP\InterfazIcedbpBundle\Entity\Preicedbp\category;
  use DBP\InterfazIcedbpBundle\Entity\Preicedbp\supplier;
  use Symfony\Component\HttpFoundation\Response;
  use Symfony\Component\HttpFoundation\Request;
  use Doctrine\ORM\Mapping as ORM;
  
  use DBP\InterfazIcedbpBundle\Form\Type\PreferencesIcecatType;
  
  
  
  class PreferencesIcecatController extends Controller
  {
      public function indexAction(Request $request)
      {
          $em = $this-&gt;getDoctrine()-&gt;getManager();
  
          $categories = $em-&gt;getRepository('DBPInterfazIcedbpBundle:Preicedbp\Category')-&gt;getAllCategories();
          $categories = $em-&gt;getRepository('DBPInterfazIcedbpBundle:Preicedbp\Category')-&gt;getCategoriesJSON($categories);
  
          $suppliers = $em-&gt;getRepository('DBPInterfazIcedbpBundle:Preicedbp\Supplier')-&gt;getAllSuppliers();
  
          $distributors = $em-&gt;getRepository('DBPInterfazIcedbpBundle:Preicedbp\Distributor')-&gt;getAllDistributors();
          $distributors = $em-&gt;getRepository('DBPInterfazIcedbpBundle:Preicedbp\Distributor')-&gt;getDistributorsJSON($distributors);
  
          $query = $em-&gt;createQuery(
                  'SELECT c.catId FROM DBPInterfazIcedbpBundle:Preicedbp\ImpCategories c WHERE c.idImpPreferences=1
                  ORDER BY c.catId ASC');
  
          $_selected = $query-&gt;getResult();
          $categories_selected = "";
          foreach($_selected  as $cat) {
              $categories_selected .= $cat['catId'].",";
          }
          //$categories_selected = $em-&gt;getRepository('DBPInterfazIcedbpBundle:Category')-&gt;getCategoriesSelectedJSON($categories_selected);
  
          $query = $em-&gt;createQuery(
                  'SELECT c.distributorId FROM DBPInterfazIcedbpBundle:Preicedbp\ImpDistributors c WHERE c.idImpPreferences=1
                  ORDER BY c.distributorId ASC');
  
          $_selected = $query-&gt;getResult();
          $distributors_selected = "";
          foreach($_selected  as $dist) {
              $distributors_selected .= $dist['distributorId'].",";
          }
  
          $query = $em-&gt;createQuery(
                  'SELECT c.supplierId FROM DBPInterfazIcedbpBundle:Preicedbp\ImpSuppliers c WHERE c.idImpPreferences=1
                  ORDER BY c.supplierId ASC');
  
          $_selected = $query-&gt;getResult();
          $suppliers_selected = "";
          foreach($_selected  as $sup) {
              $suppliers_selected .= $sup['supplierId'].",";
          }
  
          $preferences = $this-&gt;getDoctrine()-&gt;getRepository('DBPInterfazIcedbpBundle:Preicedbp\ImpPreferences')-&gt;find(1);
  
          $pref_id = $preferences-&gt;getId();
  
          $options = array('suppliers_selected'=&gt;$suppliers_selected, 'id'=&gt;$pref_id);
          $form = $this-&gt;createForm(new PreferencesIcecatType(),$options);
  
          if ($request-&gt;isMethod('POST')) {
              //Obtenemos los datos del formulario
              $form-&gt;bind($request);
              $datos = $form-&gt;getData();
  
              $datos-&gt;setTypeUpdate(1);
              //Guardamos imp_preferences automáticamente
              $em-&gt;persist($datos);
              $em-&gt;flush();
  
              //Recogemos las categorias, suppliers y dist que se guardan a parte
              $cat_selected = $form["cat_selected"]-&gt;getData();
              $sup_selected = $form["sup_selected"]-&gt;getData();
              $dist_selected = $form["dist_selected"]-&gt;getData();
  
  
              //Primero borramos lo que hay para luego insertarlo de nuevo (así me olvido de mirar si está ya insertado o no).
              $query = $em-&gt;createQuery('DELETE FROM DBPInterfazIcedbpBundle:Preicedbp\ImpSuppliers c WHERE c.idImpPreferences='.$pref_id);
              $query-&gt;getResult();
  
              $query = $em-&gt;createQuery('DELETE FROM DBPInterfazIcedbpBundle:Preicedbp\ImpDistributors c WHERE c.idImpPreferences='.$pref_id);
              $query-&gt;getResult();
  
              $query = $em-&gt;createQuery('DELETE FROM DBPInterfazIcedbpBundle:Preicedbp\ImpCategories c WHERE c.idImpPreferences='.$pref_id);
              $query-&gt;getResult();
  
              $categorias = explode(",",$cat_selected);
              foreach($categorias as $cat) {
                  if(empty($cat)) continue;
                  $conn = $em-&gt;getConnection();
                  $query = "INSERT INTO imp_categories VALUES($pref_id,$cat)";
                  $stmt = $conn-&gt;prepare($query);
                  $stmt-&gt;execute(array());
              }
  
              $fabricantes = explode(",",$sup_selected);
              foreach($fabricantes as $sup) {
                  if(empty($sup)) continue;
                  $conn = $em-&gt;getConnection();
                  $query = "INSERT INTO imp_suppliers VALUES($pref_id,$sup)";
                  $stmt = $conn-&gt;prepare($query);
                  $stmt-&gt;execute(array());
              }
  
              $distribuidores = explode(",",$dist_selected);
              foreach($distribuidores as $dist) {
                  if(empty($dist)) continue;
                  $conn = $em-&gt;getConnection();
                  $query = "INSERT INTO imp_distributors VALUES($pref_id,$dist)";
                  $stmt = $conn-&gt;prepare($query);
                  $stmt-&gt;execute(array());
              }
  
  
  
  
              $this-&gt;get('session')-&gt;getFlashBag()-&gt;add('notice', 'La configuración se ha guardado con éxito!!');
          }
  
          //Aquí vuelvo a sacar las categorias seleccionadas porque al cambiar tengo que volver a sacarlas.
  
          //$em = $this-&gt;getDoctrine()-&gt;getEntityManager();
  
          $query = $em-&gt;createQuery(
                  'SELECT c.catId FROM DBPInterfazIcedbpBundle:Preicedbp\ImpCategories c WHERE c.idImpPreferences=1
                  ORDER BY c.catId ASC');
  
          $_selected = $query-&gt;getResult();
          $categories_selected = "";
          foreach($_selected  as $cat) {
              $categories_selected .= $cat['catId'].",";
          }
          //$categories_selected = $em-&gt;getRepository('DBPInterfazIcedbpBundle:Category')-&gt;getCategoriesSelectedJSON($categories_selected);
  
          $query = $em-&gt;createQuery(
                  'SELECT c.distributorId FROM DBPInterfazIcedbpBundle:Preicedbp\ImpDistributors c WHERE c.idImpPreferences=1
                  ORDER BY c.distributorId ASC');
  
          $_selected = $query-&gt;getResult();
          $distributors_selected = "";
          foreach($_selected  as $dist) {
              $distributors_selected .= $dist['distributorId'].",";
          }
  
          $query = $em-&gt;createQuery(
                  'SELECT c.supplierId FROM DBPInterfazIcedbpBundle:Preicedbp\ImpSuppliers c WHERE c.idImpPreferences=1
                  ORDER BY c.supplierId ASC');
  
          $_selected = $query-&gt;getResult();
          $suppliers_selected = "";
          foreach($_selected  as $sup) {
              $suppliers_selected .= $sup['supplierId'].",";
          }
  
          return $this-&gt;render('DBPInterfazIcedbpBundle:Preferences:icecat_preicedbp.html.twig', 
                  array('categories'=&gt;$categories, 'suppliers'=&gt;$suppliers, 'distributors'=&gt;$distributors,
                          'categories_selected'=&gt;$categories_selected, 'distributors_selected'=&gt;$distributors_selected, 'suppliers_selected'=&gt;$suppliers_selected,
                          'preferences'=&gt;$preferences,'form' =&gt; $form-&gt;createView()));
      }       
  
  }
  </code></pre>
  
  <p>And this is my Type in \src\DBP\InterfazIcedbpBundle\Form\Type</p>
  
  <pre><code>&lt;?php
  namespace DBP\InterfazIcedbpBundle\Form\Type;
  
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  
  use Symfony\Component\OptionsResolver\OptionsResolverInterface;
  
  use DBP\InterfazIcedbpBundle\Form\DataTransformer\StringToArrayTransformer;
  
  class PreferencesIcecatType extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $suppliers_selected = $options['suppliers_selected'];
          $pref_id = $options['id'];
  
          //añadimos las categorias, fabricantes y distribuidores en un campo hidden
          $builder-&gt;add('cat_selected', 'hidden', array(
                  'data' =&gt; '', 'mapped'=&gt;false,
          ));
          $builder-&gt;add('sup_selected', 'hidden', array(
                  'data' =&gt; $suppliers_selected,'mapped'=&gt;false,
          ));
          $builder-&gt;add('dist_selected', 'hidden', array(
                  'data' =&gt; '','mapped'=&gt;false,
          ));
  
  
          $builder-&gt;add('id', 'hidden', array('data'=&gt;$pref_id,'property_path'=&gt;'id'));
          //$builder-&gt;add('id', 'hidden', array());
  
          //Añadimos el resto de campos
          $builder-&gt;add('onMarket', 'choice', array('label'=&gt;'Mercado','choices'   =&gt; array(
                  '0'   =&gt; 'Sólo productos que no estén en el mercado',
                  '1' =&gt; 'Sólo productos en el mercado',
                  '2'   =&gt; 'Todos'),'multiple'  =&gt; false));
  
          $builder-&gt;add('quality', 'choice', array('label'=&gt;'Calidad','choices'   =&gt; array(
                  'ICECAT'   =&gt; 'ICECAT',
                  'SUPPLIER' =&gt; 'SUPPLIER',
                  'NO-EDITOR'   =&gt; 'NO-EDITOR',
                  'TODOS'=&gt;'TODOS'),'multiple'  =&gt; false));
  
          $builder-&gt;add('importProducts', 'choice', array('label'=&gt;'Filtrar por','choices'   =&gt; array(
                  '1'   =&gt; 'Categorias',
                  '2' =&gt; 'Fabricantes',
                  '3'   =&gt; 'Distribuidores',
                  '0'=&gt;'TODOS'),'multiple'  =&gt; false,'expanded'=&gt;true));
  
          //$entityManager = $options['em'];
          $transformer = new StringToArrayTransformer($em);
          $builder-&gt;add($builder-&gt;create('languages', 'choice', array('label'=&gt;'Lenguajes','choices'   =&gt; array(
                  'ES'   =&gt; 'ES',
                  'EN' =&gt; 'EN',
                  ),'multiple'  =&gt; true,'expanded'=&gt;false))-&gt;addModelTransformer($transformer));
  
          $builder-&gt;add($builder-&gt;create('countryMarket', 'choice', array('label'=&gt;'Mercado','choices'   =&gt; array(
                  'ES'   =&gt; 'ES',
                  'EN' =&gt; 'EN',
          ),'multiple'  =&gt; true,'expanded'=&gt;false))-&gt;addModelTransformer($transformer));
  
          $builder-&gt;add('onlyUpdateExistings', 'checkbox', array(
                  'label'     =&gt; 'Actualizar sólo existentes',
                  'required'  =&gt; false,
          ));
  
          $builder-&gt;add('sel_cat', 'checkbox', array(
                  'label'     =&gt; 'Seleccionar/Deseleccionar',
                  'required'  =&gt; false, 'mapped'=&gt;false,
          ));
          $builder-&gt;add('sel_sup', 'checkbox', array(
                  'label'     =&gt; 'Seleccionar/Deseleccionar',
                  'required'  =&gt; false,'mapped'=&gt;false,
          ));
          $builder-&gt;add('sel_dist', 'checkbox', array(
                  'label'     =&gt; 'Seleccionar/Deseleccionar',
                  'required'  =&gt; false,'mapped'=&gt;false,
          ));
  
          $builder-&gt;add('show_only_cat', 'checkbox', array(
                  'label'     =&gt; 'Mostrar sólo seleccionadas',
                  'required'  =&gt; false,'mapped'=&gt;false,
          ));
          $builder-&gt;add('show_only_sup', 'checkbox', array(
                  'label'     =&gt; 'Mostrar sólo seleccionados',
                  'required'  =&gt; false,'mapped'=&gt;false,
          ));
          $builder-&gt;add('show_only_dist', 'checkbox', array(
                  'label'     =&gt; 'Mostrar sólo seleccionados',
                  'required'  =&gt; false,'mapped'=&gt;false,
          ));
  
  
  
          $builder-&gt;add('user_icecat', 'text', array( ));
          $builder-&gt;add('pass_icecat', 'text', array( ));
          $builder-&gt;add('icecat_route', 'text', array( ));
          $builder-&gt;add('icecat_subdir', 'text', array( ));
      }
  
      public function getName()
      {
          return 'preferences_icecat';
      }
  }
  </code></pre>