title: Symfony2 File Found Class Was Not In It
body: <p>This is my first question, besides I'm not english-native speaker, so sorry in advance for newbie mistakes...</p>
  
  <p>I'm starting with Symfony2, and I've been facing an autoload problem for a couple of days, i'm getting crazy..</p>
  
  <p>I'm just trying to use a PHP class inside my DefaultController of my AppBundle. I've read the way of doing this is by creating a service in my config.yml and giving a namespace to that class that matches.</p>
  
  <p>Symfony tells me that it does found the file but the class is not in it, the exact error is:</p>
  
  <blockquote>
    <p>The autoloader expected class "Priceget\CollectorBundle\Crawler\Amazon" to be defined in file "/srv/www/lol.com/public_html/priceget/symfony/src/Priceget/CollectorBundle/Crawler/Amazon.php". The file was found but the class was not in it, the class name or namespace probably has a typo.</p>
  </blockquote>
  
  <p>And my class is just this:</p>
  
  <pre><code>&lt;?php
  
  namespace Priceget\CollectorBundle\Crawler\Amazon;
  
  use Symfony\Component\HttpFoundation\Response;
  
  class Amazon
  {
  
      public function getAll()
      {
          return new Response('l0l');
      }
  }
  </code></pre>
  
  <p>In my DefaultController I'm calling it like that:</p>
  
  <pre><code>&lt;?php
  
  namespace Priceget\CollectorBundle\Controller;
  
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  use Guzzle\Http\Client;
  use Symfony\Component\DomCrawler\Crawler;
  use Priceget\CollectorBundle\Crawler\Amazon;
  
  class DefaultController extends Controller
  {
  
      public function indexAction()
      {
          $amazon = $this-&gt;get('amazon.crawler');
      }
  }
  </code></pre>
  
  <p>And my config.yml piece:</p>
  
  <pre><code>services:
      amazon.crawler:
          class: Priceget\CollectorBundle\Crawler\Amazon
  </code></pre>
  
  <p>I've already tried to:</p>
  
  <ul>
  <li>Empty cache</li>
  <li>Restart apache</li>
  <li>Extend the class to Controller? :-Z</li>
  </ul>
  
  <p>Thank you so much in advance.</p>