Doctrine 2.0.4 ¿Error de configuración? [cerrado

Estoy usando la doctrina 2.0.4. No estoy seguro de dónde está exactamente mal aquí, ¿alguien puede ayudarme aquí?

   <?php
error_reporting(E_ALL);
ini_set('display_errors', '1');

use Doctrine\Common\ClassLoader,
    Doctrine\ORM\Configuration,
    Doctrine\ORM\EntityManager,
    Doctrine\ORM\Tools\EntityGenerator,
    Doctrine\Common\Cache\ApcCache,
    Entities\User,Entity\Address;

$RootPath = $_SERVER['DOCUMENT_ROOT'] . '/';
require $RootPath.'doctrine2/Doctrine/Common/ClassLoader.php';

$lib = $RootPath.'doctrine2/';
$lib1 = $RootPath.'MyProject/';
$classLoader = new ClassLoader('Doctrine',$lib);
$classLoader->register();

$classLoader = new ClassLoader('Entities',$lib1);
$classLoader->register();

$classLoader = new ClassLoader('Proxies',$lib1);
$classLoader->register();

$config = new Configuration;
$cache= new ApcCache;

$driverImpl = $config->newDefaultAnnotationDriver($lib1.'Entities');
$config->setMetadataDriverImpl($driverImpl);
$config->setQueryCacheImpl($cache);


$config->setProxyDir($lib1.'Proxies');
$config->setProxyNamespace('MyProject\Proxies');


 $config->setAutoGenerateProxyClasses(true);


$connectionOptions = array(
    'driver' => 'pdo_mysql',
    'dbname' => 'test',
    'user' => 'abc',
    'password' => '123321',
    'host' => '127.0.0.1');



$em = EntityManager::create($connectionOptions, $config);
echo "<pre>";
print_r($em);
// custom datatypes (not mapped for reverse engineering)
/*$em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('set', 'string');
$em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
*/

// fetch metadata
$driver = new \Doctrine\ORM\Mapping\Driver\DatabaseDriver(
    $em->getConnection()->getSchemaManager()
);
$em->getConfiguration()->setMetadataDriverImpl($driver);
$cmf = new \Doctrine\ORM\Tools\DisconnectedClassMetadataFactory($em);
$cmf->setEntityManager($em); 
$classes = $driver->getAllClassNames();
$metadata = $cmf->getAllMetadata(); 
$generator = new EntityGenerator();
$generator->setUpdateEntityIfExists(true);
$generator->setGenerateStubMethods(true);
$generator->setGenerateAnnotations(true);
$generator->generate($metadata, $lib1 . 'Entities');
echo  'Done';
$q = $em->createQuery("select u from MyProject\Entities\Dept u ");
$users = $q->getResult();
?>

Resultando en

Error::Fatal error: Uncaught exception 'Doctrine\ORM\Query\QueryException' with message '[Semantical Error] line 0, col 14 near 'MyProject\Entities\Dept': Error: Class 'MyProject\Entities\Dept' is not defined.

Dept.php in Entities code

<?php


/**
 * Dept
 *
 * @Table(name="dept")
 * @Entity
 */
class Dept
{
    /**
     * @var integer $deptno
     *
     * @Column(name="deptno", type="integer", nullable=false)
     * @Id
     * @GeneratedValue(strategy="IDENTITY")
     */

    private $deptno;

    /**
     * @var string $dname
     *
     * @Column(name="dname", type="string", length=50, nullable=false)
     */
    private $dname;

    /**
     * @var string $location
     *
     * @Column(name="location", type="string", length=50, nullable=false)
     */
    private $location;


    /**
     * Get deptno
     *
     * @return integer $deptno
     */
    public function getDeptno()
    {
        return $this->deptno;
    }

    /**
     * Set dname
     *
     * @param string $dname
     */
    public function setDname($dname)
    {
        $this->dname = $dname;
    }

    /**
     * Get dname
     *
     * @return string $dname
     */
    public function getDname()
    {
        return $this->dname;
    }

    /**
     * Set location
     *
     * @param string $location
     */
    public function setLocation($location)
    {
        $this->location = $location;
    }

    /**
     * Get location
     *
     * @return string $location
     */
    public function getLocation()
    {
        return $this->location;
    }
}
    and Proxies class not generated here but Entities is generated...where exact wrong here? 

Respuestas a la pregunta(2)

Su respuesta a la pregunta