0
I am studying namespace in php and **Doctrine 2.2** for a week.
I explorered several blogs and read several articles about namespace in php.
And i understand that, when we want to use different namepaces in different php pages,
we must write: include('php page that belong namespace we want to use');
But Doctrine 2.2 doesn't use any include or require or require_once
statements for using namespace. Almost all script in **Doctrine 2.2** like that :
/*i am at Doctrine\ORM\EntityManager.php */
**<?php
namespace Doctrine\ORM;
use Closure, Exception,
Doctrine\Common\EventManager,
Doctrine\Common\Persistence\ObjectManager,
Doctrine\DBAL\Connection,
Doctrine\DBAL\LockMode,
Doctrine\ORM\Mapping\ClassMetadata,
Doctrine\ORM\Mapping\ClassMetadataFactory,
Doctrine\ORM\Query\ResultSetMapping,
Doctrine\ORM\Proxy\ProxyFactory,
Doctrine\ORM\Query\FilterCollection;
class EntityManager implements ObjectManager
{
/**
* The used Configuration.
*
* @var \Doctrine\ORM\Configuration
.............
..................................
..................................
..................................
..................................
?>**
There isn't any include or require statement in **Doctrine 2.2**.
But we run the page (Doctrine\ORM\EntityManager.php) appear fatal error,
致命錯誤: 接口 '學說\共同\持久性\的ObjectManager' 未找到用C :\ XAMPP \ htdocs中\ WWW \ DoctrineExplained \ DoctrineORM \學說\ ORM \ EntityManager.php第45行上爲什麼教條2.2使用-namespace-和-use-而沒有任何include或require聲明..?
Although **Doctrine 2.2** is stable version of **Doctrine ORM**,
why doesn't use include or require for --namespaces-- and --uses--?
我想,你想表達對名稱空間語句和約定的改變。不是嗎?請告訴我更多。 – 2012-02-24 00:54:46
你想知道什麼?不得不上課一直很乏味。它導致大量的包含需要加載太多代碼並增加內存佔用量。自動加載被引入來解決這個問題。 – 2012-02-24 01:43:43
再次感謝您的回覆。我只是想知道爲什麼Doctrine ORM不會在每個頁面中使用include或require。現在你解釋了原因。我以前認爲,(USE)聲明像包含或要求一樣工作。下一個可能嗎? – 2012-02-24 13:37:13