<?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);
Beispiel #2
0
 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()));
 }
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)));