pearを使用して Doctrine をインストールしたとします。
$ sudo pear install pear.doctrine-project.org/doctrineORM
これにより、DoctrineCommon、DoctrineDBAL、DoctrineORM の 3 つの「Doctrine 2」パッケージがインストールされます。Ubuntu では、これらのパッケージは /usr/share/php/Doctrine に配置され、doctrine コマンド ライン ユーティリティは /usr/bin にインストールされます。
このセットアップでは、これが使用できる cli-config.php のバージョンです (注: DIRの前後に 2 つのアンダースコアが必要です。何らかの理由で表示されませんでした)。
<?php
require ‘Doctrine/ORM/Tools/Setup.php’;
// Setup Autoloader (1)
Doctrine\ORM\Tools\Setup::registerAutoloadPEAR();
require_once 'Doctrine/Common/ClassLoader.php';
$classLoader = new Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();
$classLoader = new Doctrine\Common\ClassLoader('Proxies', __DIR__);
$classLoader->register();
$config = new \Doctrine\ORM\Configuration();
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
$driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__."/Entities"));
$config->setMetadataDriverImpl($driverImpl);
$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Proxies');
$connectionOptions = array(
'driver' => 'pdo_mysql',
'dbname' => 'bugs',
'user' => 'bugs',
'password' => 'xyzabc',
'host' => 'localhost' );
$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);
$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
));