为什么原则 2 的自动加载器在我抛出异常时尝试获取异常实体


Why does Doctrine 2's autoloader try to get the Exception entity when I throw an exception?

这是相关的代码:

throw new Exception("Message");

这是我收到的错误消息:

致命错误:require() [function.require]:需要打开失败 'C:''wamp''www''drupal-7.15''sites''all''modules''dbManip''Entities''Exception.php' (include_path='.;C:''wamp''bin''php''php5.3.13''pear''') in C:''wamp''bin''php''php5.3.13''pear''Doctrine''Common''ClassLoader.php on line 163

我相信 Doctrine 试图加载 Exception 类定义,就好像它只是我的另一个实体一样,但据我所知,Exception是 PHP 原生的(我使用的是 PHP 5.3.13)。我的理论是我在自动加载机方面做错了什么,但我不确定是什么。这是我对自动加载机的看法:

use Doctrine'ORM'Tools'Setup;
require_once("Doctrine/ORM/Tools/Setup.php");
Setup::registerAutoloadPEAR();
$classloader = new Doctrine'Common'ClassLoader('Entities', __DIR__);
$classloader->register();

我在这里做错了什么?如何在没有 doctrine 的自动加载器尝试加载Exception实体的情况下使用抛出异常?

这是

PHP在起作用。不是教义。

在命名空间中声明文件时,它将对文件中提到的所有类使用相同的命名空间。若要指示 Exception 类来自根命名空间,必须将其显式化。

throw new 'Exception("Message");