本文整理汇总了PHP中Doctrine\ORM\Tools\Setup::registerAutoloadPEAR方法的典型用法代码示例。如果您正苦于以下问题:PHP Setup::registerAutoloadPEAR方法的具体用法?PHP Setup::registerAutoloadPEAR怎么用?PHP Setup::registerAutoloadPEAR使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\Tools\Setup
的用法示例。
在下文中一共展示了Setup::registerAutoloadPEAR方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
// bootstrap_doctrine.php
// See :doc:`Configuration <../reference/configuration>` for up to date autoloading details.
use Doctrine\ORM\Tools\Setup;
require_once "Doctrine/ORM/Tools/Setup.php";
Setup::registerAutoloadPEAR();
// Create a simple "default" Doctrine ORM configuration for XML Mapping
$isDevMode = true;
$config = Setup::createXMLMetadataConfiguration(array(__DIR__ . "/config/xml"), $isDevMode);
// or if you prefer yaml or annotations
//$config = Setup::createAnnotationMetadataConfiguration(array(__DIR__."/entities"), $isDevMode);
//$config = Setup::createYAMLMetadataConfiguration(array(__DIR__."/config/yaml"), $isDevMode);
// database configuration parameters
$conn = array('driver' => 'pdo_sqlite', 'path' => __DIR__ . '/db.sqlite');
// obtaining the entity manager
$entityManager = \Doctrine\ORM\EntityManager::create($conn, $config);
示例2: testPEARAutoload
public function testPEARAutoload()
{
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . "/../../../../../lib/vendor/doctrine-common/lib");
Setup::registerAutoloadPEAR();
$this->assertEquals($this->originalAutoloaderCount + 2, count(spl_autoload_functions()));
}
示例3: array
cp cli<?php
// cli-config.php
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
require 'Doctrine/ORM/Tools/Setup.php';
Doctrine\ORM\Tools\Setup::registerAutoloadPEAR();
$paths = array("./Entities");
$isDevMode = true;
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$dbParams = array('driver' => 'pdo_mysql', 'dbname' => 'bugs_db_cbe', 'user' => 'bugs_db_cbe', 'password' => 'kk0457', 'host' => 'localhost');
$em = EntityManager::create($dbParams, $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)));