title: Symfony " 'use' statement for another namespace?" issue
body: <p>I have a problem with namespaces in connecting my entity class to an abstract-type class.</p>
  
  <p>I needed to create an <code>AbstractType</code> Class I called <strong>BlogFactory</strong>. I intent to use it in my the <code>createAction</code> function of my <strong>BlogController.php</strong> Entity class for creating blog entries.</p>
  
  <p>My <code>BlogFactory</code> class is created in the <strong>Form/Blog</strong> directory of my bundle, as the tree structure shows.</p>
  
  <pre><code>.
  .
  .
  src/Blogger/BlogBundle/
  ├── Controller
  │   ├── BlogController.php
  │   └── PageController.php
  ├── DataFixtures
  │   └── ORM
  │       └── BlogFixtures.php
  ├── Entity
  │   ├── Blog.php
  │   ├── Blog.php~
  │   └── Enquiry.php
  ├── Form
  │   ├── Blog
  │   │   ├── BlogFactory.php
  │   │   └── Factory.php
  │   └── EnquiryType.php
  ├── Resources
  │   ├── config
  │   │   ├── config.yml
  │   │   ├── routing.yml
  │   │   └── services.yml
  .
  .
  .
  </code></pre>
  
  <p>In the <code>BlogController.php</code> entity class, I include the following <strong>use</strong> instruction: </p>
  
  <pre><code>namespace Blogger\BlogBundle\Controller;
  
  use Symfony\Component\HttpFoundation\Request;
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  use Blogger\BlogBundle\Form\Blog\BlogFactory;
  
  class BlogController extends Controller{
  .
  .
  .
  </code></pre>
  
  <p>with the following <code>createAction</code> function:</p>
  
  <pre><code>public function createAction(){   
          $form = $this-&gt;createForm(new BlogFactory(), new Blog(), 
              array(
                  'action' =&gt; $this-&gt;generateUrl('blog_create'),
                  'method' =&gt; 'POST',
              )
          );
  
          $form-&gt;add('submit', 'submit', array('label'=&gt;'Create'));
          return $form;
      }
  </code></pre>
  
  <p>Here is the code in my <code>BlogFactory</code> class:</p>
  
  <pre><code>namespace Blogger\BlogBundle\Form;
  
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  
  class BlogFactory extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder-&gt;add('title');
          $builder-&gt;add('author');
          $builder-&gt;add('blog');
          $builder-&gt;add('image');
      }
  
      public function getName()
      {
          return 'newblog';
      }
  }
  </code></pre>
  
  <p>However, my problem is I get the following error:</p>
  
  <pre><code>The autoloader expected class "Blogger\BlogBundle\Form\Blog\BlogFactory" to be defined in file "/var/www/Symfony-Blog/src/Blogger/BlogBundle/Form/Blog/BlogFactory.php". The file was found but the class was not in it, the class name or namespace probably has a typo
  </code></pre>
  
  <p>I'm quite stuck and not sure how to resolve this.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>As suggested by Gnucki, I added <strong>namespace Blogger\BlogBundle\Form\Blog;</strong> to my BlogFactory.php and <strong>use Blogger\BlogBundle\Form\Blog\BlogFactory;</strong> to BlogController.php, and got the slightly different error below:</p>
  
  <pre><code>Attempted to load class "Blog" from namespace "Blogger\BlogBundle\Controller".
  Did you forget a "use" statement for another namespace?
  </code></pre>