Symfony 3: Doctrine listAction: Did you forget a "use" statement for another namespace?
<p>I'm trying to make an easy listAction to retrieve data from Doctrine but I got this error:</p>

<pre><code>Attempted to load class "ProductRepository" from namespace "AppBundle\Entity".
Did you forget a "use" statement for another namespace?
</code></pre>

<p>This come out when i call the route ex.com/list that must
 to list the data coming from product table</p>

<p><strong>Controller:</strong> (src/AppBundle/Controller)</p>

<pre><code>&lt;?php

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\MessageSelector;
use AppBundle\Entity\Product;
use Symfony\Component\HttpFoundation\Response;


new Translator('it', new MessageSelector(), __DIR__.'/../cache');

class DefaultController extends Controller
{
/**
 * @Route("/", name="homepage")
 * @param Request $request
 * @return \Symfony\Component\HttpFoundation\Response
 */
public function indexAction(Request $request)
{
    $request-&gt;getLocale();

    $request-&gt;setLocale('it');

    return $this-&gt;render('default/index.html.twig', [
        'base_dir' =&gt; realpath($this-&gt;getParameter('kernel.root_dir').'/..'),
    ]);
}

/**
 *
 * @Route("list", name="list")
 * @return Response
 *
 */
public function listAction()
{
    return $product = $this-&gt;getDoctrine()
        -&gt;getRepository('AppBundle\Entity\Product')
        -&gt;findAll();

   /* if (!$product) {
        throw $this-&gt;createNotFoundException(
            'Nessun prodotto trovato'
        );
    }*/

}

/**
 * @Route("create",name="create")
 * @return Response
 */
public function createAction()
{
    $product = new Product();
    $product-&gt;setName('Pippo Pluto');
    $product-&gt;setPrice('19.99');
    $product-&gt;setDescription('Lorem ipsum dolor');
    $product-&gt;setSeller('1');

    $em = $this-&gt;getDoctrine()-&gt;getManager();

    $em-&gt;persist($product);
    $em-&gt;flush();

    return $this-&gt;render('default/index.html.twig');
}

/**
 * @param $id
 * @Route("show/{id}",name="show/{id}")
 * @return Response
 */
public function showAction($id)
{
    $product = new Product();
    $product = $this-&gt;getDoctrine()
        -&gt;getRepository('AppBundle:Product')
        -&gt;find($id);

    if (!$product) {
        throw $this-&gt;createNotFoundException(
            'Nessun prodotto trovato per l\'id '.$id
        );
    }
  }
}
</code></pre>

<p><strong>Entity:</strong> (src/AppBundle/Entity)</p>

<pre><code>namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
* Product
*
* @ORM\Table(name="product")
* @ORM\Entity(repositoryClass="AppBundle\Entity\ProductRepository")
*/
class Product
{
/**
 * @var int
 *
 * @ORM\Column(name="`id`", type="integer")
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="AUTO")
 */
private $id;

/**
 * @var string
 *
 * @ORM\Column(name="`name`", type="string")
 */
private $name;
/**
 * @var float
 *
 * @ORM\Column(name="`price`", type="float")
 */
private $price;
/**
 * @var string
 *
 * @ORM\Column(name="`description`", type="string")
 */
private $description;
/**
 * @var int
 *
 * @ORM\Column(name="`seller`", type="integer")
 */
private $seller;


/**
 * Get id
 *
 * @return int
 */
public function getId()
{
    return $this-&gt;id;
}

/**
 * Set name
 *
 * @param string $name
 *
 * @return Product
 */
public function setName($name)
{
    $this-&gt;name = $name;

    return $this;
}
/**
 * Set price
 *
 * @param float $price
 *
 * @return Product
 */
public function setPrice($price) {
    $this-&gt;price = $price;

    return $this;
}
/**
 * Set description
 *
 * @param string $description
 *
 * @return Product
 */
public function setDescription($description) {
    $this-&gt;description = $description;

    return $this;
}
/**
 * Set seller
 *
 * @param int $seller
 *
 * @return Product
 */
public function setSeller($seller) {
    $this-&gt;seller = $seller;

    return $this;
}
/**
 * Get name
 *
 * @return string
 */
public function getName()
{
    return $this-&gt;name;
}
/**
 * Get price
 *
 * @return float
 */
public function getPrice()
{
    return $this-&gt;price;
}
/**
 * Get description
 *
 * @return string
 */
public function getDescription()
{
    return $this-&gt;description;
}
/**
 * Get seller
 *
 * @return int
 */
public function getSeller()
   {
    return $this-&gt;seller;
   }
}
</code></pre>

<p>I can't understand what I'm missing to use. thanks.</p>