title: Symfony2: Class not found error
body: <p>Im getting a <code>Class not found</code> error on this line:  </p>
  
  <pre><code>new \Placas\FrontendBundle\Form\Type\ChoiceOrTextType(),
  </code></pre>
  
  <p>I have the class at <code>Placas/FrontendBundle/Form/Type</code>.</p>
  
  <p>Here are the codes, the instantation:</p>
  
  <pre><code>namespace Placas\FrontendBundle\Admin;
  
  use Sonata\AdminBundle\Admin\Admin;
  use Sonata\AdminBundle\Datagrid\ListMapper;
  use Sonata\AdminBundle\Datagrid\DatagridMapper;
  use Sonata\AdminBundle\Form\FormMapper;
  use Sonata\AdminBundle\Route\RouteCollection;
  use Placas\FrontendBundle\Form\Type\ChoiceOrTextType;
  
  class CategoriaAdmin extends Admin
  {
      public $last_position = 0;
  
      private $container;
      private $positionService;
  
      public function setContainer(\Symfony\Component\DependencyInjection\ContainerInterface $container)
      {
          $this-&gt;container = $container;
      }
  
      public function setPositionService(\Pix\SortableBehaviorBundle\Services\PositionHandler $positionHandler)
      {
          $this-&gt;positionService = $positionHandler;
      }
  
      protected $datagridValues = array(
          '_page' =&gt; 1,
          '_sort_order' =&gt; 'ASC',
          '_sort_by' =&gt; 'position',
      );
  
      protected function configureFormFields(FormMapper $formMapper)
      {
          $options = array('required' =&gt; false, 'label' =&gt; 'Imagen');
          if ($this-&gt;getSubject()-&gt;getImageName()) {
              $path = $this-&gt;getSubject()-&gt;getImageName();
              $options['help'] = '&lt;img style="width: 300px; border: 1px solid #ccc" src="/images/' . $path . '" /&gt;';
          }
  
          $formMapper
              -&gt;add('nombre', 'text', array('label' =&gt; 'Nombre', 'required' =&gt; false ))
              //-&gt;add('image', 'file', $options)
              -&gt;add('activado', 'checkbox', array('label' =&gt; 'Activado', 'required' =&gt; false ))
              -&gt;add('menu', new ChoiceOrTextType(), array(
      'choices'  =&gt; array('Option 1' =&gt; 'Option 1', 'Option 2' =&gt; 'Option 2'),
      'required' =&gt; false,))
              ;
  
      }
  
      // Fields to be shown on lists
      protected function configureListFields(ListMapper $listMapper)
      {
          $this-&gt;last_position = $this-&gt;positionService-&gt;getLastPosition($this-&gt;getRoot()-&gt;getClass());
          $listMapper
              -&gt;addIdentifier('nombre')
              -&gt;add('activado')
              -&gt;add('position', array(), array('label' =&gt; 'Posición'))
              -&gt;add('_action', 'actions', array(
                  'label' =&gt; 'Cambio orden',
                  'actions' =&gt; array(
                      'move' =&gt; array('template' =&gt; 'PixSortableBehaviorBundle:Default:_sort.html.twig'),
                  )));
      }
  
      protected function configureRoutes(RouteCollection $collection)
      {
          $collection-&gt;add('move', $this-&gt;getRouterIdParameter() . '/move/{position}');
      }
  
  }
  </code></pre>
  
  <p>The class: </p>
  
  <pre><code>use Symfony\Component\Form\AbstractType;
  use Symfony\Component\OptionsResolver\OptionsResolverInterface;
  use Placas\FrontendBundle\DataTransformer\ValueToChoiceOrTextTransformer;
  use Symfony\Component\Form\FormBuilderInterface;
  use Symfony\Component\Form\FormInterface;
  use Symfony\Component\Form\FormView;
  
  class ChoiceOrTextType extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              -&gt;add('choice', 'choice', array(
                  'choices' =&gt; $options['choices'] + array('Other' =&gt; 'Other'),
                  'required' =&gt; false,
              ))
              -&gt;add('text', 'text', array(
                  'required' =&gt; false,
              ))
              -&gt;addModelTransformer(new ValueToChoiceOrTextTransformer($options['choices']))
          ;
      }
  
      public function setDefaultOptions(OptionsResolverInterface $resolver)
      {
          $resolver-&gt;setRequired(array('choices'));
          $resolver-&gt;setAllowedTypes(array('choices' =&gt; 'array'));
      }
      public function buildView(FormView $view, FormInterface $form, array $options)
      {
      }
  
      public function finishView(FormView $view, FormInterface $form, array $options)
      {
      }
      public function getParent()
      {
          return 'form';
      }
  
      public function getName()
      {
          return 'tags';
      }
  }
  </code></pre>
  
  <hr>
  
  <pre><code>$ pwd
  /home/tirengarfio/workspace/mareva/src/Placas/FrontendBundle/Form/Type
  $ ls
  ChoiceOrTextType.php  
  </code></pre>
  
  <p>Im just trying to follow the answer <a href="https://stackoverflow.com/questions/11634377/use-a-conditional-statement-when-creating-a-form">here</a>. </p>